diff options
author | Caroline Chao <caroline.chao@digia.com> | 2013-03-05 11:11:02 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-07 11:58:50 +0100 |
commit | 04592dae5067b87b39e1ae9387e522fb394159d6 (patch) | |
tree | 650add2fca1e0876050696108f5fcb27b3841ae1 /src/quick/items | |
parent | ffd48e1ff75f03fb4d684eeb5a47a526cc1b0d47 (diff) |
TextInput: Update text deselection on focus out event
The text selection should not be cleared when the focus
out event received has one the following reasons:
- Qt::ActiveWindowFocusReason
- Qt::PopupFocusReason
When the user opens a menu or navigates to another window,
the eventual selection should not be clearer.
This also makes the behavior consistent with TextEdit.
Change-Id: Ibc6242cb2f8207cf5281925c8e20b88394f21eea
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 67664add78..58cc68495c 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2500,7 +2500,10 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event) updatePasswordEchoEditing(false);//QQuickTextInputPrivate sets it on key events, but doesn't deal with focus events } - if (!persistentSelection) + if (event->reason() != Qt::ActiveWindowFocusReason + && event->reason() != Qt::PopupFocusReason + && hasSelectedText() + && !persistentSelection) deselect(); #ifndef QT_NO_IM |