path: root/src
diff options
authorRichard Moe Gustavsen <>2016-09-08 13:59:13 +0200
committerShawn Rutledge <>2016-09-15 14:18:09 +0000
commit43a65845e6148a2346b2ccdb2442cef6c43df94c (patch)
tree11cfe273c43f2e4d0e547b2c0fe4dc7fe6514b9c /src
parent2a7bfd6b37552b5812fa0e18f0212121d6c1703a (diff)
QQuickTextInput: avoid emitting editingFinished twice
On platforms like iOS, hiding the virtual keyboard will force the current focus object to lose focus. And when QQuickTextInput loses focus, it will emit editingFinished. To not emit the signal once more directly after hiding the keyboard, we add an extra check in the key event handler to verify that we still have focus. Task-number: QTBUG-44038 Change-Id: Ib64f7028a9f16a172b3c38cab72f3599d560e331 Reviewed-by: Liang Qi <> Reviewed-by: Shawn Rutledge <>
Diffstat (limited to 'src')
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index f3b217dd7f..072bfd3440 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -4197,8 +4197,13 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event)
if (!(q->inputMethodHints() & Qt::ImhMultiLine))
+ if (activeFocus) {
+ // If we lost focus after hiding the virtual keyboard, we've already emitted
+ // editingFinished from handleFocusEvent. Otherwise we emit it now.
+ emit q->editingFinished();
+ }
emit q->accepted();
- emit q->editingFinished();