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.