[Interest] QML: Optional Menus in MenuBar

Daiwei Li daiweili at gmail.com
Fri Aug 9 02:42:17 CEST 2013


Hi all,

I would like to be able to include Menus in my ApplcationWindow's MenuBar
based on the platform. e.g.:

import QtQuick 2.1

import QtQuick.Controls 1.0

import QtQuick.Window 2.0


ApplicationWindow {

    title: qsTr("Hello World")

    width: 640

    height: 480

        menuBar: MenuBar {

        Menu {

            title: qsTr("File")

            *visible: Qt.platform.os === "win"*

            MenuItem {

                text: qsTr("Exit")

                onTriggered: Qt.quit();

            }

        }

    }

}


Unfortunately, this example doesn't work (the menu is still there) because
Menu.visible is ignored unless Menu is a submenu. Does anyone know how I
can conditionally show a menu in the menubar?

Thanks,
Daiwei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130808/1e7225a0/attachment.html>


More information about the Interest mailing list