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

MenuBar QML Type

A native menubar.

This type was introduced in Qt 5.8.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

MenuBar QML Type

  • Import Statement: import Qt.labs.platform

  • Since:: Qt 5.8

  • Inherits:: QtObject

Detailed Description

The MenuBar type provides a QML API for native platform menubars.

Image non disponible

A menubar consists of a list of drop-down menus.

 
Sélectionnez
MenuBar {
    id: menuBar

    Menu {
        id: fileMenu
        title: qsTr("File")
        // ...
    }

    Menu {
        id: editMenu
        title: qsTr("&Edit")
        // ...
    }

    Menu {
        id: viewMenu
        title: qsTr("&View")
        // ...
    }

    Menu {
        id: helpMenu
        title: qsTr("&Help")
        // ...
    }
}

MenuBar is currently available on the following platforms:

  • macOS

  • Android

  • Linux (only available on desktop environments that provide a global D-Bus menu bar)

  • Windows

Types in Qt.labs modules are not guaranteed to remain compatible in future versions.

See Also

See also Menu

Property Documentation

 

[default] data : list<QtObject>

This default property holds the list of all objects declared as children of the menubar. The data property includes objects that are not Menu instances, such as Timer and QtObject.

See Also

See also menus

menus : list<Menu>

window : Window

This property holds the menubar's window.

Unless explicitly set, the window is automatically resolved by iterating the QML parent objects until a Window or an Item that has a window is found.

Method Documentation

 

void addMenu(Menu menu)

Adds a menu to end of the menubar.

void clear()

Removes all menus from the menubar.

void insertMenu(int index, Menu menu)

Inserts a menu at the specified index in the menubar.

void removeMenu(Menu menu)

Removes a menu from the menubar.

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