forked from qt-creator/qt-creator
Added "Copy Line" keyboard command and associated action
Merge-request: 223 Reviewed-by: Leandro Melo
This commit is contained in:
committed by
Leandro Melo
parent
420345380a
commit
8ae4317394
@@ -5031,6 +5031,15 @@ void BaseTextEditorWidget::cutLine()
|
|||||||
cut();
|
cut();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// control+shift+insert
|
||||||
|
void BaseTextEditorWidget::copyLine()
|
||||||
|
{
|
||||||
|
QTextCursor prevCursor = textCursor();
|
||||||
|
maybeSelectLine();
|
||||||
|
copy();
|
||||||
|
setTextCursor(prevCursor);
|
||||||
|
}
|
||||||
|
|
||||||
void BaseTextEditorWidget::deleteLine()
|
void BaseTextEditorWidget::deleteLine()
|
||||||
{
|
{
|
||||||
maybeSelectLine();
|
maybeSelectLine();
|
||||||
|
|||||||
@@ -247,6 +247,7 @@ public slots:
|
|||||||
void zoomReset();
|
void zoomReset();
|
||||||
|
|
||||||
void cutLine();
|
void cutLine();
|
||||||
|
void copyLine();
|
||||||
void deleteLine();
|
void deleteLine();
|
||||||
void unfoldAll();
|
void unfoldAll();
|
||||||
void fold();
|
void fold();
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ TextEditorActionHandler::TextEditorActionHandler(const char *context,
|
|||||||
m_foldAction(0),
|
m_foldAction(0),
|
||||||
m_unfoldAction(0),
|
m_unfoldAction(0),
|
||||||
m_cutLineAction(0),
|
m_cutLineAction(0),
|
||||||
|
m_copyLineAction(0),
|
||||||
m_deleteLineAction(0),
|
m_deleteLineAction(0),
|
||||||
m_selectEncodingAction(0),
|
m_selectEncodingAction(0),
|
||||||
m_increaseFontSizeAction(0),
|
m_increaseFontSizeAction(0),
|
||||||
@@ -201,6 +202,11 @@ void TextEditorActionHandler::createActions()
|
|||||||
command->setDefaultKeySequence(QKeySequence(tr("Shift+Del")));
|
command->setDefaultKeySequence(QKeySequence(tr("Shift+Del")));
|
||||||
connect(m_cutLineAction, SIGNAL(triggered()), this, SLOT(cutLine()));
|
connect(m_cutLineAction, SIGNAL(triggered()), this, SLOT(cutLine()));
|
||||||
|
|
||||||
|
m_copyLineAction = new QAction(tr("Copy &Line"), this);
|
||||||
|
command = am->registerAction(m_copyLineAction, Constants::COPY_LINE, m_contextId);
|
||||||
|
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Ins")));
|
||||||
|
connect(m_copyLineAction, SIGNAL(triggered()), this, SLOT(copyLine()));
|
||||||
|
|
||||||
m_deleteLineAction = new QAction(tr("Delete &Line"), this);
|
m_deleteLineAction = new QAction(tr("Delete &Line"), this);
|
||||||
command = am->registerAction(m_deleteLineAction, Constants::DELETE_LINE, m_contextId, true);
|
command = am->registerAction(m_deleteLineAction, Constants::DELETE_LINE, m_contextId, true);
|
||||||
connect(m_deleteLineAction, SIGNAL(triggered()), this, SLOT(deleteLine()));
|
connect(m_deleteLineAction, SIGNAL(triggered()), this, SLOT(deleteLine()));
|
||||||
@@ -527,6 +533,7 @@ FUNCTION2(selectAllAction, selectAll)
|
|||||||
FUNCTION(cleanWhitespace)
|
FUNCTION(cleanWhitespace)
|
||||||
FUNCTION(unCommentSelection)
|
FUNCTION(unCommentSelection)
|
||||||
FUNCTION(cutLine)
|
FUNCTION(cutLine)
|
||||||
|
FUNCTION(copyLine)
|
||||||
FUNCTION(deleteLine)
|
FUNCTION(deleteLine)
|
||||||
FUNCTION(unfoldAll)
|
FUNCTION(unfoldAll)
|
||||||
FUNCTION(fold)
|
FUNCTION(fold)
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ private slots:
|
|||||||
void fold();
|
void fold();
|
||||||
void unfold();
|
void unfold();
|
||||||
void cutLine();
|
void cutLine();
|
||||||
|
void copyLine();
|
||||||
void deleteLine();
|
void deleteLine();
|
||||||
void selectEncoding();
|
void selectEncoding();
|
||||||
void increaseFontSize();
|
void increaseFontSize();
|
||||||
@@ -165,6 +166,7 @@ private:
|
|||||||
QAction *m_foldAction;
|
QAction *m_foldAction;
|
||||||
QAction *m_unfoldAction;
|
QAction *m_unfoldAction;
|
||||||
QAction *m_cutLineAction;
|
QAction *m_cutLineAction;
|
||||||
|
QAction *m_copyLineAction;
|
||||||
QAction *m_deleteLineAction;
|
QAction *m_deleteLineAction;
|
||||||
QAction *m_selectEncodingAction;
|
QAction *m_selectEncodingAction;
|
||||||
QAction *m_increaseFontSizeAction;
|
QAction *m_increaseFontSizeAction;
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ const char * const INSERT_LINE_BELOW = "TextEditor.InsertLineBelowCurrentLin
|
|||||||
const char * const UPPERCASE_SELECTION = "TextEditor.UppercaseSelection";
|
const char * const UPPERCASE_SELECTION = "TextEditor.UppercaseSelection";
|
||||||
const char * const LOWERCASE_SELECTION = "TextEditor.LowercaseSelection";
|
const char * const LOWERCASE_SELECTION = "TextEditor.LowercaseSelection";
|
||||||
const char * const CUT_LINE = "TextEditor.CutLine";
|
const char * const CUT_LINE = "TextEditor.CutLine";
|
||||||
|
const char * const COPY_LINE = "TextEditor.CopyLine";
|
||||||
const char * const DELETE_LINE = "TextEditor.DeleteLine";
|
const char * const DELETE_LINE = "TextEditor.DeleteLine";
|
||||||
const char * const DELETE_WORD = "TextEditor.DeleteWord";
|
const char * const DELETE_WORD = "TextEditor.DeleteWord";
|
||||||
const char * const SELECT_ENCODING = "TextEditor.SelectEncoding";
|
const char * const SELECT_ENCODING = "TextEditor.SelectEncoding";
|
||||||
|
|||||||
Reference in New Issue
Block a user