From 59840faacfb682a9503c026a6e0357c6ebf97b00 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 23 Apr 2015 14:22:53 +0200 Subject: 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 --- src/widgets/widgets/qwidgettextcontrol.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/widgets/widgets') 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); } -- cgit v1.2.3