diff options
author | Andy Shaw <andy.shaw@digia.com> | 2014-05-22 18:39:37 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-03 13:24:54 +0200 |
commit | dd2f05b35a5aa3477316a37f865db5d4abb661ae (patch) | |
tree | 0946b70b22364f379fda9a776e9156b1e1c00472 | |
parent | eb71d505f5a20b6022ad130a4deda3a1e5c3fa4d (diff) | |
download | qtquickcontrols-dd2f05b35a5aa3477316a37f865db5d4abb661ae.tar.gz |
FileDialog: handle back and esc keys to reject the dialog
When the dialog was open then pressing the Android back button would
cause it to quit the application as it just went straight through.
Task-number: QTBUG-39204
Change-Id: I69e5f39ab90a5c280ae4dbd1a498fb6f3d4dcf1e
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
-rw-r--r-- | src/dialogs/DefaultFileDialog.qml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/dialogs/DefaultFileDialog.qml b/src/dialogs/DefaultFileDialog.qml index 7ebd443a..3423dfd2 100644 --- a/src/dialogs/DefaultFileDialog.qml +++ b/src/dialogs/DefaultFileDialog.qml @@ -139,6 +139,18 @@ AbstractFileDialog { property: "text" value: root.urlToPath(root.folder) } + Keys.onPressed: { + event.accepted = true + switch (event.key) { + case Qt.Key_Back: + case Qt.Key_Escape: + reject() + break + default: + event.accepted = false + break + } + } SplitView { id: splitter |