aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickwindow/data/shortcutOverride.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickwindow/data/shortcutOverride.qml')
-rw-r--r--tests/auto/quick/qquickwindow/data/shortcutOverride.qml30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickwindow/data/shortcutOverride.qml b/tests/auto/quick/qquickwindow/data/shortcutOverride.qml
new file mode 100644
index 0000000000..960035c10f
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/shortcutOverride.qml
@@ -0,0 +1,30 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+import QtQuick
+import QtQuick.Window
+
+Window {
+ id: root
+ visible: true
+ width: 200
+ height: 200
+
+ property bool overridden: false
+ property bool receivedA: false
+ property bool receivedB: false
+ Item {
+ Keys.onShortcutOverride: (e) => e.accepted = root.overridden = (e.key === Qt.Key_A)
+
+ Item {
+ focus: true
+ Shortcut {
+ sequence: "A"
+ onActivated: root.receivedA = true
+ }
+ Shortcut {
+ sequence: "B"
+ onActivated: root.receivedB = true
+ }
+ }
+ }
+}