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>
This commit is contained in:
Ulf Hermann 2019-05-16 15:46:22 +02:00
parent c49bb5bda3
commit 1427b243cb
2 changed files with 30 additions and 1 deletions

View File

@ -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);

View File

@ -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);
}
}