aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-05-16 15:46:22 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-05-16 13:57:45 +0000
commit1427b243cb69768e7ce2e6ea3ad75619deac104b (patch)
tree6ae219fa30f425bdf955027a557ca7a0ea4d3e52
parentc49bb5bda32477a878b6b82b99f853cef1340890 (diff)
Don't unnecessarily transform keysequences into strings
Otherwise we cannot interpret them as the original key sequence anymore. When passing them on they are interpreted as the number key that represents the numeric value of the key sequence enum. Change-Id: Idd94ef95bc693cb6d51162dd1994adc953b52e25 Fixes: QTBUG-75572 Reviewed-by: Henning Gründl <henning.gruendl@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/quicktemplates2/qquickaction.cpp2
-rw-r--r--tests/auto/controls/data/tst_action.qml29
2 files changed, 30 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickaction.cpp b/src/quicktemplates2/qquickaction.cpp
index e83fd353..033173f8 100644
--- a/src/quicktemplates2/qquickaction.cpp
+++ b/src/quicktemplates2/qquickaction.cpp
@@ -185,7 +185,7 @@ void QQuickActionPrivate::setShortcut(const QVariant &var)
for (QQuickActionPrivate::ShortcutEntry *entry : qAsConst(shortcutEntries))
entry->ungrab();
- vshortcut = var.toString();
+ vshortcut = var;
keySequence = variantToKeySequence(var);
defaultShortcutEntry->grab(keySequence, enabled);
diff --git a/tests/auto/controls/data/tst_action.qml b/tests/auto/controls/data/tst_action.qml
index ef28c0e5..0e41b7f3 100644
--- a/tests/auto/controls/data/tst_action.qml
+++ b/tests/auto/controls/data/tst_action.qml
@@ -165,4 +165,33 @@ TestCase {
keyClick(Qt.Key_A, Qt.ControlModifier)
compare(spy.count, 1)
}
+
+ Component {
+ id: shortcutBinding
+ Item {
+ Action {
+ id: action
+ shortcut: StandardKey.Copy
+ }
+
+ Shortcut {
+ id: indirectShortcut
+ sequence: action.shortcut
+ }
+
+ Shortcut {
+ id: directShortcut
+ sequence: StandardKey.Copy
+ }
+
+ property alias indirect: indirectShortcut;
+ property alias direct: directShortcut
+ }
+ }
+
+ function test_shortcutBinding() {
+ var container = createTemporaryObject(shortcutBinding, testCase);
+ verify(container)
+ compare(container.indirect.nativeText, container.direct.nativeText);
+ }
}