MenuItem QML Type
Presents an item within a Menu. 更多...
Import Statement: | import QtQuick.Controls 2.2 |
开始支持版本: | Qt 5.7 |
基类: |
属性
- highlighted : bool
信号
- void triggered()
详细描述
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() } } }
参见 Customizing MenuItem and Menu Controls.
属性
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
.