Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [QML Android] Menu bar disappeared after adding ApplicationWindowStyle to ApplicationWindow
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Mobile and Embedded
1 Posts 1 Posters 657 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nagardd
    wrote on last edited by nagardd
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved