diff options
Diffstat (limited to 'src/gui/widgets/qtextedit.cpp')
-rw-r--r-- | src/gui/widgets/qtextedit.cpp | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index dc78fd5..b894aa8 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -1220,8 +1220,35 @@ void QTextEdit::keyPressEvent(QKeyEvent *e) break; } #endif +#ifndef QT_NO_SHORTCUT - if (!(d->control->textInteractionFlags() & Qt::TextEditable)) { + Qt::TextInteractionFlags tif = d->control->textInteractionFlags(); + + if (tif & Qt::TextSelectableByKeyboard){ + if (e == QKeySequence::SelectPreviousPage) { + e->accept(); + d->pageUpDown(QTextCursor::Up, QTextCursor::KeepAnchor); + return; + } else if (e ==QKeySequence::SelectNextPage) { + e->accept(); + d->pageUpDown(QTextCursor::Down, QTextCursor::KeepAnchor); + return; + } + } + if (tif & (Qt::TextSelectableByKeyboard | Qt::TextEditable)) { + if (e == QKeySequence::MoveToPreviousPage) { + e->accept(); + d->pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor); + return; + } else if (e == QKeySequence::MoveToNextPage) { + e->accept(); + d->pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor); + return; + } + } +#endif // QT_NO_SHORTCUT + + if (!(tif & Qt::TextEditable)) { switch (e->key()) { case Qt::Key_Space: e->accept(); @@ -1248,26 +1275,6 @@ void QTextEdit::keyPressEvent(QKeyEvent *e) return; } -#ifndef QT_NO_SHORTCUT - if (e == QKeySequence::MoveToPreviousPage) { - e->accept(); - d->pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor); - return; - } else if (e == QKeySequence::MoveToNextPage) { - e->accept(); - d->pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor); - return; - } else if (e == QKeySequence::SelectPreviousPage) { - e->accept(); - d->pageUpDown(QTextCursor::Up, QTextCursor::KeepAnchor); - return; - } else if (e ==QKeySequence::SelectNextPage) { - e->accept(); - d->pageUpDown(QTextCursor::Down, QTextCursor::KeepAnchor); - return; - } -#endif // QT_NO_SHORTCUT - { QTextCursor cursor = d->control->textCursor(); const QString text = e->text(); |