MenuItem QML Type
Presents an item within a Menu. More...
| Import Statement: | import QtQuick.Controls 2.2 |
| Since: | Qt 5.7 |
| Inherits: |
Properties
- highlighted : bool
Signals
- void triggered()
Detailed Description
MenuItem is a convenience type that implements the AbstractButton API, providing a familiar way to respond to menu items being triggered, for example.
Button {
id: fileButton
text: "File"
onClicked: menu.open()
Menu {
id: menu
MenuItem {
text: "New..."
onTriggered: document.reset()
}
MenuItem {
text: "Open..."
onTriggered: openDialog.open()
}
MenuItem {
text: "Save"
onTriggered: saveDialog.open()
}
}
} See also Customizing MenuItem and Menu Controls.
Property Documentation
highlighted : bool
This property holds whether the menu item is highlighted.
A menu item can be highlighted in order to draw the user's attention towards it. It has no effect on keyboard interaction.
The default value is false.
Signal Documentation
void triggered()
This signal is emitted when the menu item is triggered by the user.
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.9/qml-qtquick-controls2-menuitem.html