summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-12-12 08:18:03 +0100
committerMontel Laurent <[email protected]>2017-12-12 08:18:03 +0100
commit87ee755e5a8aa299d8e270bafceaa7976424dc7a (patch)
tree5732f7ca1ada29f23d70406954e8f8a06a782c93
parentfe535a76683afe92e64f3e5ee304b389b962888e (diff)
Add shortcut for moving up/down line
-rw-r--r--src/texteditor/plaintexteditor/plaintexteditor.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/texteditor/plaintexteditor/plaintexteditor.cpp b/src/texteditor/plaintexteditor/plaintexteditor.cpp
index b1cdfb5..69411e9 100644
--- a/src/texteditor/plaintexteditor/plaintexteditor.cpp
+++ b/src/texteditor/plaintexteditor/plaintexteditor.cpp
@@ -42,6 +42,7 @@
#include <QScrollBar>
#include <QApplication>
#include <QClipboard>
+#include <QShortcut>
#include <sonnet/spellcheckdecorator.h>
@@ -103,6 +104,12 @@ PlainTextEditor::PlainTextEditor(QWidget *parent)
KCursor::setAutoHideCursor(this, true, false);
setSpellCheckingConfigFileName(QString());
d->mInitialFontSize = font().pointSize();
+ QShortcut *moveUp = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up), this);
+ connect(moveUp, &QShortcut::activated, [this]() {moveLineUpDown(true);});
+
+ QShortcut *moveDown = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down), this);
+ connect(moveDown, &QShortcut::activated, [this]() {moveLineUpDown(false);});
+
}
PlainTextEditor::~PlainTextEditor()
@@ -638,7 +645,6 @@ void PlainTextEditor::deleteEndOfLine()
void PlainTextEditor::moveLineUpDown(bool moveUp)
{
- qDebug() << " void PlainTextEditor::moveUpDownText(bool moveUp)" << moveUp;
QTextCursor cursor = textCursor();
QTextCursor move = cursor;
move.beginEditBlock();