Default application created by Qt Creator does not display its menubar



  • Following these steps using:
    Qt Creator 3.1.2
    Qt 5.3.1
    Clan 5.0, Apple 64 bit

    File->New File or Project

    Projects.Applications
    Qt Quick Application
    enter name
    Qt Quick Controls 1.1
    Desktop Qt 5.2 clang 64bit
    no version control

    run and no menu bar appears - just text box

    why? Shouldn't there be a menubar with a File option?

    Here’s the initial code the application generates
    @
    import QtQuick 2.2
    import QtQuick.Controls 1.1

    ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }
    
    Text {
        text: qsTr("Hello World")
        anchors.centerIn: parent
    }
    

    }
    @



  • Welcome to the forum. This is the default behaviour as MAC already provides quit button. Since "Quit App" comes by default in MAC, this menu option is taken out as it is not necessary. Just change to "Exit" to "xExit", it works.


Log in to reply
 

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