Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.12.3
-
None
-
1427b243cb69768e7ce2e6ea3ad75619deac104b (qt/qtquickcontrols2/5.12)
Description
There is an issue with converting StandardKey enums to native text in shortcuts. The example below is showing the the issue and a workaround to get the native shortcut as a text. Only when converting the actions shortcut explicitly to an int it is possible to get the correct nativeText.
import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Action { id: action text: "Redo" shortcut: StandardKey.Copy } Shortcut { id: shortcut sequence: action.shortcut } Shortcut { property int tmp: action.shortcut id: shortcutWorkaround sequence: tmp } Component.onCompleted: { console.log(action.shortcut + " " + shortcut.sequence + " " + shortcut.nativeText) console.log(action.shortcut + " " + shortcutWorkaround.sequence + " " + shortcutWorkaround.nativeText) } }
qml: 9 9 9 qml: 9 9 Ctrl+C