diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index b826a12ad..ee2da3531 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -103,10 +103,10 @@ QTextControlPrivate::QTextControlPrivate() hasFocus(false), isEnabled(true), hadSelectionOnMousePress(false), - ignoreUnusedNavigationEvents(false), openExternalLinks(false), wordSelectionEnabled(false) -{} +{ +} bool QTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e) { @@ -227,32 +227,15 @@ bool QTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e) return false; } -// Except for pageup and pagedown, Mac OS X has very different behavior, we don't do it all, but -// here's the breakdown: -// Shift still works as an anchor, but only one of the other keys can be down Ctrl (Command), -// Alt (Option), or Meta (Control). -// Command/Control + Left/Right -- Move to left or right of the line -// + Up/Down -- Move to top bottom of the file. (Control doesn't move the cursor) -// Option + Left/Right -- Move one word Left/right. -// + Up/Down -- Begin/End of Paragraph. -// Home/End Top/Bottom of file. (usually don't move the cursor, but will select) - bool visualNavigation = cursor.visualNavigation(); cursor.setVisualNavigation(true); const bool moved = cursor.movePosition(op, mode); cursor.setVisualNavigation(visualNavigation); q->ensureCursorVisible(); - bool ignoreNavigationEvents = ignoreUnusedNavigationEvents; - bool isNavigationEvent = e->key() == Qt::Key_Up || e->key() == Qt::Key_Down; - - isNavigationEvent = isNavigationEvent || e->key() == Qt::Key_Left || e->key() == Qt::Key_Right; - if (moved) { if (cursor.position() != oldCursorPos) emit q->cursorPositionChanged(); - } else if (ignoreNavigationEvents && isNavigationEvent && oldSelection.anchor() == cursor.anchor()) { - return false; } selectionChanged(/*forceEmitSelectionChanged =*/(mode == QTextCursor::KeepAnchor)); @@ -2080,18 +2063,6 @@ bool QTextControl::openExternalLinks() const return d->openExternalLinks; } -bool QTextControl::ignoreUnusedNavigationEvents() const -{ - Q_D(const QTextControl); - return d->ignoreUnusedNavigationEvents; -} - -void QTextControl::setIgnoreUnusedNavigationEvents(bool ignore) -{ - Q_D(QTextControl); - d->ignoreUnusedNavigationEvents = ignore; -} - void QTextControl::moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode) { Q_D(QTextControl); diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h index 9194843f8..dfe03ea75 100644 --- a/src/gui/text/qtextcontrol_p.h +++ b/src/gui/text/qtextcontrol_p.h @@ -66,7 +66,6 @@ class Q_GUI_EXPORT QTextControl : public QObject Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) - Q_PROPERTY(bool ignoreUnusedNavigationEvents READ ignoreUnusedNavigationEvents WRITE setIgnoreUnusedNavigationEvents) public: explicit QTextControl(QObject *parent = nullptr); explicit QTextControl(const QString &text, QObject *parent = nullptr); @@ -135,9 +134,6 @@ public: void setOpenExternalLinks(bool open); bool openExternalLinks() const; - void setIgnoreUnusedNavigationEvents(bool ignore); - bool ignoreUnusedNavigationEvents() const; - void moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); bool canPaste() const; diff --git a/src/gui/text/qtextcontrol_p_p.h b/src/gui/text/qtextcontrol_p_p.h index 4aaeb645f..c3d65e8a2 100644 --- a/src/gui/text/qtextcontrol_p_p.h +++ b/src/gui/text/qtextcontrol_p_p.h @@ -182,7 +182,6 @@ public: QString anchorOnMousePress; bool hadSelectionOnMousePress; - bool ignoreUnusedNavigationEvents; bool openExternalLinks; bool wordSelectionEnabled;