summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorjahonkon <jani.honkonen@digia.com>2011-11-11 09:59:47 (GMT)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-11-11 09:59:47 (GMT)
commit054fa68b6ae852e84f2d44a73260b4282286f5ab (patch)
tree7f8eda126d5f95a65a2d00162641adc99f8502f4 /src/gui
parentb0c09896a239197411027e773214a2635744695c (diff)
downloadQt-054fa68b6ae852e84f2d44a73260b4282286f5ab.zip
Qt-054fa68b6ae852e84f2d44a73260b4282286f5ab.tar.gz
Qt-054fa68b6ae852e84f2d44a73260b4282286f5ab.tar.bz2
Fix QPlainTextEdit when using Qt::TextSelectableByKeyboard flag
It is not possible to select text with keyboard when specifying only Qt::TextSelectableByKeyboard flag. Task-number: QTBUG-18952 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qtextcontrol.cpp7
-rw-r--r--src/gui/widgets/qplaintextedit.cpp2
2 files changed, 3 insertions, 6 deletions
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 5babbc2..ffcd90b 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -2029,10 +2029,7 @@ void QTextControlPrivate::focusEvent(QFocusEvent *e)
#endif
))) {
#endif
- cursorOn = (interactionFlags & Qt::TextSelectableByKeyboard);
- if (interactionFlags & Qt::TextEditable) {
- setBlinkingCursorEnabled(true);
- }
+ setBlinkingCursorEnabled(interactionFlags & (Qt::TextEditable | Qt::TextSelectableByKeyboard));
#ifdef QT_KEYPAD_NAVIGATION
}
#endif
@@ -2808,7 +2805,7 @@ void QTextControl::setTextInteractionFlags(Qt::TextInteractionFlags flags)
d->interactionFlags = flags;
if (d->hasFocus)
- d->setBlinkingCursorEnabled(flags & Qt::TextEditable);
+ d->setBlinkingCursorEnabled(flags & (Qt::TextEditable | Qt::TextSelectableByKeyboard));
}
Qt::TextInteractionFlags QTextControl::textInteractionFlags() const
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index f2fca8f..3b2c8fd 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -1900,7 +1900,7 @@ void QPlainTextEdit::paintEvent(QPaintEvent *e)
}
}
- bool drawCursor = (editable
+ bool drawCursor = ((editable || (textInteractionFlags() & Qt::TextSelectableByKeyboard))
&& context.cursorPosition >= blpos
&& context.cursorPosition < blpos + bllen);