MenuItem QML Type

A menu item within a Menu. More...

Import Statement: import QtQuick.Controls 2.0
Since: Qt 5.7




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"

    Menu {
        id: menu

        MenuItem {
            text: "New..."
            onTriggered: document.reset()
        MenuItem {
            text: "Open..."
        MenuItem {
            text: "Save"

See also Customizing MenuItem and Menu Controls.

Property Documentation

checkable : bool

This property holds whether the menu item is checkable.

A checkable menu item toggles between checked (on) and unchecked (off) when the user clicks on it or interacts with it via the keyboard.

See also checked.

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.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.