MenuItem QML Type

Presents an item within a Menu. 更多...

import 语句: import QtQuick.Controls 2.2
Since: Qt 5.7
继承: AbstractButton

特性

信号

详细描述

MenuItem is a convenience type that implements the AbstractButton API, providing a familiar way to respond to menu items being triggered ,例如。

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 菜单控件 .

特性文档编制

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.

默认值为 false .


信号文档编制

void triggered ()

This signal is emitted when the menu item is triggered by the user.