MenuItem QML Type | Qt Labs Controls 5.6

Qt 5.6 | Qt Labs Controls | QML Types | MenuItem QML Type

Qt 5.6.3 Reference Documentation

# MenuItem QML Type

A menu item within a Menu. More...

Import Statement: | import Qt.labs.controls 1.0
Inherits: | Control

- List of all members, including inherited members

## Signals

- void triggered()

## Detailed Description

MenuItem is a convenience type that implements the AbstractButton API, providing an easy way to respond to menu items being clicked, for example.

      Button {
          id: fileButton
          text: "File"
          onClicked: menu.open()
      }
      Menu {
          id: menu
          anchor.target: fileButton

          MenuItem {
              text: "New..."
          }
          MenuItem {
              text: "Open..."
          }
          MenuItem {
              text: "Save"
          }
      }

Note: Types in the Qt.labs module are not guaranteed to remain compatible in future versions.

See also Customizing MenuItem and Menu Controls.

## Signal Documentation

void triggered()

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