[QML Android] Menu bar disappeared after adding ApplicationWindowStyle to ApplicationWindow



  • Hi All,

    I have created Qt Quick Controls Application (Android Kit) in QT 5.6.
    Then I tried to change ApplicationWindow color by styles:

    style: ApplicationWindowStyle {
                background: Rectangle { color: "#77add5" }
               }
    

    But after that the Menu bar disappeared in my Android 6.0 (LG G3):
    Screenshot: https://drive.google.com/open?id=0B98DRDMEPX8LM1BsSXFTdkNlYUk

    I have done the same for desktop application and menu bar not disappear.

    What is the problem?

    My code for Android:

    import QtQuick 2.6
    import QtQuick.Controls 1.5
    import QtQuick.Dialogs 1.2
    import QtQuick.Controls.Styles 1.4
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
        //color: "#38d524"
    
        //When this is active menu item disappears
        style: ApplicationWindowStyle {
                background: Rectangle { color: "#77add5" }
               }
    
        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();
            }
        }
    }
    
    

    Thanks,
    Daniel


Log in to reply
 

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