Properties |
| Action | action |
| | The Action associated with the menu item.
|
| bool | autoRepeat |
| | Whether the menu item should accept auto-repeated key events.
|
| bool | checkable |
| | Whether the menu item is checkable.
|
| bool | checked |
| | Whether the menu item is checked.
|
| bool | enabled |
| | Whether the menu item is enabled.
|
| ExclusiveGroup | exclusiveGroup |
| | The exclusive group to which the menu item belongs.
|
| string | iconName |
| | The name of the icon to be used.
|
| string | iconSource |
| | The source of the icon to be used.
|
|
variant | shortcut |
| | The keyboard shorcut used to trigger the menu item.
|
|
string | text |
| | The text to be displayed in the menu item.
|
| bool | visible |
| | Whether the menu item is visible in the menu.
|
Represents an action in a Menu or MenuBar.
The MenuItem is used to add an action to a Menu or MenuBar. MenuItem can also be used to display a visual item that is declared as its child.
Menu {
id: menu
MenuItem {
text: qsTr(
"MenuItem One")
onTriggered: console.log(qsTr("MenuItem One
triggered"))
}
MenuItem {
text: qsTr(
"MenuItem Two")
onTriggered: console.log(qsTr("MenuItem Two
triggered"))
}
Menu {
title: qsTr("Submenu One")
MenuItem {
text: qsTr(
"MenuItem Three")
onTriggered: console.log(qsTr("MenuItem Three
triggered"))
}
}
}
filters: [
MenuItem {
onTriggered: console.log(qsTr("Filter One selected"))
},
MenuItem {
onTriggered: console.log(qsTr("Filter Two selected"))
}
]
MenuItem {
text: qsTr(
"MenuItem One")
onTriggered: console.log(qsTr("MenuItem One
triggered"))
}
MenuItem {
text: qsTr(
"MenuItem Two")
onTriggered: console.log(qsTr("MenuItem Two
triggered"))
}
MenuItem {
text: qsTr(
"Menu CheckBox")
}
}
MenuItem {
}
}
- See Also
- Menu, MenuBar
- Examples:
- actions.qml, menus.qml, and tabs.qml.