diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2013-10-30 13:19:42 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-01 17:53:07 +0100 |
commit | f82e2df554f3d66f88e0b6c8c02b1efe894248cb (patch) | |
tree | 4808663fdc95610332771ef285aa495498c90760 /src/quick/items/qquickwindow.cpp | |
parent | 51a2943c018cc435cd840b7f8b6f3b1bff3c96e8 (diff) |
QQuickWindowPrivate: implement clearFocusObject
Ref change: cfa85c7 (qtbase)
Implement QQuickWindowPrivate::clearFocus()
to enable platform plugins to remove focus from the
focus object when the virtual keyboard closes.
On mobile platforms line edits etc are not supposed to
be drawn with focus and blinking cursors unless the
virtual keyboard (or another keyboard) is open. With the
new virtual QWindowPrivate::clearFocus() the
platforms can remove focus without deactivating the
whole window.
The old implementation on iOS deactivated the whole window
when the keyboard was closed. But this was unfortunate,
especially in QtQuick, since a qquicktextinput would
not get active focus unless the window was active. But
the platform would not activate the window unless the
keybaord was open. So, a classic chicken - egg problem.
Change-Id: I62e652a3cd85f1313713c5d086d9537cc2f9826f
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index ed97325c85..dd338af1e3 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -819,6 +819,11 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, notifyFocusChangesRecur(changed.data(), changed.count() - 1); } +void QQuickWindowPrivate::clearFocusObject() +{ + contentItem->setFocus(false, Qt::OtherFocusReason); +} + void QQuickWindowPrivate::notifyFocusChangesRecur(QQuickItem **items, int remaining) { QPointer<QQuickItem> item(*items); |