diff options
author | Caroline Chao <caroline.chao@digia.com> | 2014-01-29 13:59:15 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-03 14:19:14 +0100 |
commit | 12cd4496ab43c2d4ed406ce366fc33f3917c4c60 (patch) | |
tree | fb4f0b530afd70847a090d534b3ec4645f2c90f6 /examples | |
parent | 17788ca8f0d6fe4fb0d03e99e34ed667fde54379 (diff) | |
download | qtquickcontrols-12cd4496ab43c2d4ed406ce366fc33f3917c4c60.tar.gz |
Touch example: Fix back navigation
The Key event needs to be in a item that has focus.
Change-Id: I6f7293ac74b477e37c200dbb7ee8629d4f769d05
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quick/controls/touch/main.qml | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/examples/quick/controls/touch/main.qml b/examples/quick/controls/touch/main.qml index ab5d534f..163ec937 100644 --- a/examples/quick/controls/touch/main.qml +++ b/examples/quick/controls/touch/main.qml @@ -52,16 +52,6 @@ ApplicationWindow { anchors.fill: parent } - // Implements back key navigation - Keys.onReleased: { - if (event.key === Qt.Key_Back) { - if (stackView.depth > 1) { - stackView.pop(); - event.accepted = true; - } else { Qt.quit(); } - } - } - toolBar: BorderImage { border.bottom: 8 source: "images/toolbar.png" @@ -133,6 +123,12 @@ ApplicationWindow { StackView { id: stackView anchors.fill: parent + // Implements back key navigation + focus: true + Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) { + stackView.pop(); + event.accepted = true; + } initialItem: Item { width: parent.width |