forked from qt-creator/qt-creator
QmlDesigner: Make shortcut accessible from the MenuItem
The shortcut property is accessible directly for the MenuItem. Change-Id: I6d956859411a02dcd9c9610cfa4ccffb2e7867e7 Reviewed-by: Henning Gründl <henning.gruendl@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -9,6 +9,8 @@ import StudioTheme 1.0 as StudioTheme
|
||||
T.MenuItem {
|
||||
id: control
|
||||
|
||||
property alias shortcut: itemAction.shortcut
|
||||
|
||||
property StudioTheme.ControlStyle style: StudioTheme.Values.controlStyle
|
||||
|
||||
property int labelSpacing: control.style.contextMenuLabelSpacing
|
||||
@@ -22,7 +24,9 @@ T.MenuItem {
|
||||
padding: 0
|
||||
spacing: 0
|
||||
horizontalPadding: control.style.contextMenuHorizontalPadding
|
||||
action: Action {}
|
||||
action: Action {
|
||||
id: itemAction
|
||||
}
|
||||
|
||||
contentItem: Item {
|
||||
Text {
|
||||
@@ -39,14 +43,14 @@ T.MenuItem {
|
||||
id: shortcutLabel
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: shortcut.nativeText
|
||||
text: shortcutObserver.nativeText
|
||||
font: control.font
|
||||
color: textLabel.color
|
||||
|
||||
Shortcut {
|
||||
id: shortcut
|
||||
property int shortcutWorkaround: control.action.shortcut ?? 0
|
||||
sequence: shortcut.shortcutWorkaround
|
||||
id: shortcutObserver
|
||||
property int shortcutWorkaround: control.shortcut ?? 0
|
||||
sequence: shortcutObserver.shortcutWorkaround
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user