Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

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

    Mobile and Embedded
    1
    1
    545
    Loading More Posts
    • 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
      nagardd last edited by nagardd

      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 Reply Quote 0
      • First post
        Last post