diff options
Diffstat (limited to 'src/widgets/widgets/qplaintextedit.cpp')
-rw-r--r-- | src/widgets/widgets/qplaintextedit.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 4a875975a4..0a81931b57 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -54,6 +54,7 @@ #endif #include <qstyle.h> #include <qtimer.h> +#include "private/qapplication_p.h" #include "private/qtextdocumentlayout_p.h" #include "private/qabstracttextdocumentlayout_p.h" #include "qtextdocument.h" @@ -824,9 +825,6 @@ void QPlainTextEditPrivate::init(const QString &txt) viewport->setCursor(Qt::IBeamCursor); #endif originalOffsetY = 0; -#if 0 // Used to be included in Qt4 for Q_WS_WIN - setSingleFingerPanEnabled(true); -#endif } void QPlainTextEditPrivate::_q_textChanged() @@ -1573,7 +1571,7 @@ bool QPlainTextEdit::event(QEvent *e) } #ifdef QT_KEYPAD_NAVIGATION else if (e->type() == QEvent::EnterEditFocus || e->type() == QEvent::LeaveEditFocus) { - if (QApplication::keypadNavigationEnabled()) + if (QApplicationPrivate::keypadNavigationEnabled()) d->sendControlEvent(e); } #endif @@ -1588,7 +1586,7 @@ bool QPlainTextEdit::event(QEvent *e) d->originalOffsetY = vBar->value(); QPointF offset = g->offset(); if (!offset.isNull()) { - if (QApplication::isRightToLeft()) + if (QGuiApplication::isRightToLeft()) offset.rx() *= -1; // QPlainTextEdit scrolls by lines only in vertical direction QFontMetrics fm(document()->defaultFont()); @@ -1691,7 +1689,7 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e) #ifdef QT_KEYPAD_NAVIGATION switch (e->key()) { case Qt::Key_Select: - if (QApplication::keypadNavigationEnabled()) { + if (QApplicationPrivate::keypadNavigationEnabled()) { if (!(d->control->textInteractionFlags() & Qt::LinksAccessibleByKeyboard)) setEditFocus(!hasEditFocus()); else { @@ -1709,14 +1707,14 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e) break; case Qt::Key_Back: case Qt::Key_No: - if (!QApplication::keypadNavigationEnabled() - || (QApplication::keypadNavigationEnabled() && !hasEditFocus())) { + if (!QApplicationPrivate::keypadNavigationEnabled() + || (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus())) { e->ignore(); return; } break; default: - if (QApplication::keypadNavigationEnabled()) { + if (QApplicationPrivate::keypadNavigationEnabled()) { if (!hasEditFocus() && !(e->modifiers() & Qt::ControlModifier)) { if (e->text()[0].isPrint()) { setEditFocus(true); @@ -1792,7 +1790,7 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e) switch (e->key()) { case Qt::Key_Up: case Qt::Key_Down: - if (QApplication::keypadNavigationEnabled()) { + if (QApplicationPrivate::keypadNavigationEnabled()) { // Cursor position didn't change, so we want to leave // these keys to change focus. e->ignore(); @@ -1801,7 +1799,7 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e) break; case Qt::Key_Left: case Qt::Key_Right: - if (QApplication::keypadNavigationEnabled() + if (QApplicationPrivate::keypadNavigationEnabled() && QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { // Same as for Key_Up and Key_Down. e->ignore(); @@ -1810,7 +1808,7 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e) break; case Qt::Key_Back: if (!e->isAutoRepeat()) { - if (QApplication::keypadNavigationEnabled()) { + if (QApplicationPrivate::keypadNavigationEnabled()) { if (document()->isEmpty()) { setEditFocus(false); e->accept(); @@ -1836,7 +1834,7 @@ void QPlainTextEdit::keyReleaseEvent(QKeyEvent *e) { #ifdef QT_KEYPAD_NAVIGATION Q_D(QPlainTextEdit); - if (QApplication::keypadNavigationEnabled()) { + if (QApplicationPrivate::keypadNavigationEnabled()) { if (!e->isAutoRepeat() && e->key() == Qt::Key_Back && d->deleteAllTimer.isActive()) { d->deleteAllTimer.stop(); @@ -2080,7 +2078,7 @@ void QPlainTextEdit::mousePressEvent(QMouseEvent *e) { Q_D(QPlainTextEdit); #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) + if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) setEditFocus(true); #endif d->sendControlEvent(e); @@ -2212,7 +2210,7 @@ void QPlainTextEdit::inputMethodEvent(QInputMethodEvent *e) Q_D(QPlainTextEdit); #ifdef QT_KEYPAD_NAVIGATION if (d->control->textInteractionFlags() & Qt::TextEditable - && QApplication::keypadNavigationEnabled() + && QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) { setEditFocus(true); selectAll(); // so text is replaced rather than appended to @@ -2649,7 +2647,7 @@ void QPlainTextEdit::setReadOnly(bool ro) d->control->setTextInteractionFlags(flags); setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); QEvent event(QEvent::ReadOnlyChange); - QApplication::sendEvent(this, &event); + QCoreApplication::sendEvent(this, &event); } /*! |