QtQuick 5.4 in QtCreator 5.5 Mac OS X 10.9.5: menuBar missing from template project on execute. What the???? [SOLVED]



  • Hi community,
    I am rather frustrated. I have just upgraded to QtCreator 5.5 for Mac OS X and created a new QtQuick Application and immediately after the project was generated, I ran the application. Upon running, I noticed that the menuBar is missing from the application but exists in the code. What is the deal here? Are the sample templates broken or did someone forget to compile something in the SDK??? I have spent the past 3 hours trying to find a solution or an indication as to why the menuBar is simply missing from the application.

    I am really interested in learning to use QtQuick, but I can't justify recommending it to my company if simple things like this require massive amounts of time to research and seek help over.

    Any ideas or help would be appreciated.

    I would like to add that the rest of the application seems to be running fine... just missing the menubar, it just not display at all in the application. Seems like there are several of these "weird" inconsistencies that we have encountered.

    Here is the code that is generated when the project is created:

    import QtQuick 2.5
    import QtQuick.Controls 1.4
    import QtQuick.Dialogs 1.2
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
    
        menuBar: MenuBar {
            Menu {
                title: qsTr("File")
                MenuItem {
                    text: qsTr("&Open")
                    onTriggered: console.log("Open action triggered");
                }
                MenuItem {
                    text: qsTr("Exit")
                    onTriggered: Qt.quit();
                }
            }
        }
    
        MainForm {
            anchors.fill: parent
            button1.onClicked: messageDialog.show(qsTr("Button 1 pressed"))
            button2.onClicked: messageDialog.show(qsTr("Button 2 pressed"))
        }
    
        MessageDialog {
            id: messageDialog
            title: qsTr("May I have your attention, please?")
    
            function show(caption) {
                messageDialog.text = caption;
                messageDialog.open();
            }
        }
    }
    

    [edit: added missing coding tags ```SGaist]


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    The exit action has special handling on OS X because it belongs to the menu item corresponding to your application name. The File menu should be beside it.

    Are you getting any error message on the console ?



  • Thank you for your reply. No errors, no warnings... nothing during compile. I literally create the project and click run and the entire menu bar is simply not showing in the application provided/generated by QtCreator.

    Is this just a bug with QtCreator for this version or for all versions? Seems like I saw this behavior in QtQuick under QtCreator 5.4 as well, which was why I put it on hold for awhile hoping they were going to fix it.


  • Lifetime Qt Champion

    What version of OS X are you using ?

    Are you still experiencing the same with this lighter version of the code ?

    import QtQuick 2.5
    import QtQuick.Controls 1.4
    
    ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    
    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("&Open")
                onTriggered: console.log("Open action triggered");
            }
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }
    


  • OS X 10.9.5

    And yes, I have even tried to use Qt 5.4 with the same result.



  • I went ahead and filed a bug at:
    https://bugreports.qt.io/browse/QTCREATORBUG-14958

    I verified this exists in older versions of QtCreator also


  • Lifetime Qt Champion

    Ok, I see the problem: you're looking for the menu at the wrong place.

    On OS X there's no such thing as menu bar on the main window itself: look at the top of the screen besides the apple top left, you'll see the application name which is the main menu where you'll find the exit action and beside it the File menu you added.



  • Yep. That was totally the problem. Because I was compiling for Windows, Android and Mac OS X, I never even considered looking there and since the other two seemed to render, I thought something was broken on my machine or in the SDK. Thank you so much for your help!


  • Lifetime Qt Champion

    You're welcome !

    SInce everything is OK now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

    Also, while browsing the forum, consider up-voting the answers that helped you, it will make them easier to find for other users :)



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.