MenuItem QML Type | Qt Quick Controls 6.7.3
Description: Presents an item within a Menu.

- Qt 6.7
- Qt Quick Controls
- QML Types
- MenuItem
- Qt 6.7.3 Reference Documentation

# MenuItem QML Type

Presents an item within a Menu. More...

Import Statement: | import QtQuick.Controls
Inherits: | AbstractButton

- List of all members, including inherited members

## Properties

- arrow : Item `(since QtQuick.Controls 2.3 (Qt 5.10))`
- highlighted : bool
- menu : Menu `(since QtQuick.Controls 2.3 (Qt 5.10))`
- subMenu : Menu `(since QtQuick.Controls 2.3 (Qt 5.10))`

## Signals

- void triggered()

## 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.

MenuItem inherits its API from AbstractButton. For instance, you can set text and icon using the AbstractButton API.

     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()
             }
         }
     }

See also Customizing Menu, Menu, and Menu Controls.

## Property Documentation

arrow : Item `[since QtQuick.Controls 2.3 (Qt 5.10)]`

This property holds the sub-menu arrow item.

This property was introduced in QtQuick.Controls 2.3 (Qt 5.10).

See also Customizing Menu.

highlighted : bool

This property holds whether the menu item is highlighted by the user.

A menu item can be highlighted by mouse hover or keyboard navigation.

The default value is `false`.

See also Menu::currentIndex.

menu : Menu `[read-only, since QtQuick.Controls 2.3 (Qt 5.10)]`

This property holds the menu that contains this menu item, or `null` if the item is not in a menu.

This property was introduced in QtQuick.Controls 2.3 (Qt 5.10).

subMenu : Menu `[read-only, since QtQuick.Controls 2.3 (Qt 5.10)]`

This property holds the sub-menu that this item presents in the parent menu, or `null` if this item is not a sub-menu item.

This property was introduced in QtQuick.Controls 2.3 (Qt 5.10).

## Signal Documentation

void triggered()

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

Note: The corresponding handler is `onTriggered`.