Important: Please read the Qt Code of Conduct -

MenuBar from Qt.labs.platform

  • Hi,

    I tried using the Qt labs platform menubar, but the following test application does not show a menu:

    import QtQuick 2.12
    import QtQuick.Window 2.10
    import Qt.labs.platform 1.0 as Platform
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
        Platform.MenuBar {
            id: menuBar
            Platform.Menu {
                id: fileMenu
                title: qsTr("File")
                // ...
                Platform.MenuItem {
                    text: qsTr("Zoom In")
                    shortcut: StandardKey.ZoomIn
                    onTriggered: zoomIn()
            Platform.Menu {
                id: editMenu
                title: qsTr("&Edit")
                // ...
            Platform.Menu {
                id: viewMenu
                title: qsTr("&View")
                // ...
            Platform.Menu {
                id: helpMenu
                title: qsTr("&Help")
                // ...


    What am I missing?

  • Hi @maxwell31

    Did you notice the Application Output ? ( I tested on Qt 5.9.2 )

    This gives you the hint i feel.

    ERROR: No native Menu implementation available.
    Qt Labs Platform requires Qt Widgets on this setup.
    Add 'QT += widgets' to .pro and create QApplication in main().

    All the best

  • Hm, I did not get such an error message, using Qt 5.12 and 5.13. also adding widgets did not change anything

  • Hi @maxwell31

    • create QApplication in main().

    If my guess is right your main.cpp has QGuiApplication, you need to change it to QApplication to support Qt Labs Platform.

    On Android: (As MenuBar is currently available on macOS, Android & Linux Desktop only)


    All the best.

  • I confirm the same problem MenuBar with QT 5.12.7 QT Labs Platform Experimental 1.1 under linux CentOS 7 (+last updates). I tried to use unsuccessfully: QT+=widgets & QApplication & with/without QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar).
    But the qml control FileDialog perfect works as system FileDialog as widget FileDialog (Qt::AA_DontUseNativeDialogs).

    PS Under the windows ( qt 5.13 ) it works fine.

    PPS main.qml:

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtQuick.Controls 2.12
    import QtQuick.Layouts 1.12
    import QtQuick.Dialogs 1.3 as OldDialogs
    import Qt.labs.platform 1.1
    import Qt.labs.settings 1.1
    import "qrc:/../3rdparty/controls"
    ApplicationWindow {
        visible: true
        width: 1024
        height: 600
        minimumWidth: 400
        minimumHeight: 200
        MenuBar {
            Menu {
                title: qsTr("&File")
                Menu {
                    title: qsTr("&New")
       FileDialog {
            fileMode: FileDialog.OpenFile

    The solution: Do not use Qt labs anymore :-///

Log in to reply