IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

MenuItem QML Type

Presents an item within a Menu.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

MenuItem QML Type

  • Import Statement: import QtQuick.Controls

  • Inherits:: AbstractButton

  • Group: MenuItem is part of qtquickcontrols-menus

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

 
Sélectionnez
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()
        }
    }
}

I-1. See Also

II. Property Documentation

 

II-1. [since QtQuick.Controls 2.3 (Qt 5.10)] arrow : Item

This property holds the sub-menu arrow item.

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

II-1-1. See Also

See also Customizing Menu

II-2. 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.

II-2-1. See Also

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

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

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

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

III. Signal Documentation

 

III-1. void triggered()

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

The corresponding handler is onTriggered.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+