summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@theqtcompany.com>2015-04-23 14:22:53 +0200
committerDavid Schulz <david.schulz@theqtcompany.com>2015-05-18 05:55:27 +0000
commit59840faacfb682a9503c026a6e0357c6ebf97b00 (patch)
treef972c62264f4b544bf1cd782387bbc5a61d7041b /src
parentea92ee8e1551ead4186fa4e65c33a87a3b558a52 (diff)
Respecting correct text interaction flags when setting text cursor.
Currently the text cursor is hidden when a cursor was set using setTextCursor on a widget with a widget text control and the interaction flag TextSelectableByKeyboard. The documentation indicates that this is incorrect behavior. Change-Id: I624a470617f15d09f5772213016e552a5149424c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index faa63cb400..53b2406fc1 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -883,7 +883,8 @@ void QWidgetTextControl::setTextCursor(const QTextCursor &cursor)
const bool posChanged = cursor.position() != d->cursor.position();
const QTextCursor oldSelection = d->cursor;
d->cursor = cursor;
- d->cursorOn = d->hasFocus && (d->interactionFlags & Qt::TextEditable);
+ d->cursorOn = d->hasFocus
+ && (d->interactionFlags & (Qt::TextSelectableByKeyboard | Qt::TextEditable));
d->_q_updateCurrentCharFormatAndSelection();
ensureCursorVisible();
d->repaintOldAndNewSelection(oldSelection);
@@ -2138,7 +2139,7 @@ void QWidgetTextControlPrivate::focusEvent(QFocusEvent *e)
#ifdef QT_KEYPAD_NAVIGATION
if (!QApplication::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason))) {
#endif
- cursorOn = (interactionFlags & Qt::TextSelectableByKeyboard);
+ cursorOn = (interactionFlags & (Qt::TextSelectableByKeyboard | Qt::TextEditable));
if (interactionFlags & Qt::TextEditable) {
setBlinkingCursorEnabled(true);
}