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 ToolBarStyle hides Android Menu (Qt 5.5.1)
QtWS25 Last Chance

QML ToolBarStyle hides Android Menu (Qt 5.5.1)

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
qmlandroidtoolbarstylemenu
2 Posts 1 Posters 1.2k 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.
  • bchimpB Offline
    bchimpB Offline
    bchimp
    wrote on last edited by
    #1

    Here is basically some cut and paste QML from the documentation... an Application window with a MenuBar and a ToolBar. Run it for Desktop, it works fine. Run it on android it works fine (the menu bar is integrated on the right of the toolbar.) However, when I add the ToolBarStyle to change the background of the toolbar, the menu is gone under android. This has got to be something simple, I've tried a gazillion googles and different permutations, but no joy. Has anyone got a clue on this one?

    import QtQuick 2.3
    import QtQuick.Controls 1.2
    import QtQuick.Layouts 1.1
    import QtQuick.Controls.Styles 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();
                }
                
            }
        }
        
        toolBar: ToolBar {
             // THIS STYLE CAUSES ANDROID MENU TO DISAPPEAR
            style: ToolBarStyle {
                background: Rectangle {
                   color: "green"
                }
            }
            RowLayout {
                anchors.fill: parent
                ToolButton {
                    text: "foo"
                }
            }
            
        }
       
        Label {
            text: qsTr("Hello World")
            anchors.centerIn: parent
        }
    }
    
    
    bchimpB 1 Reply Last reply
    0
    • bchimpB bchimp

      Here is basically some cut and paste QML from the documentation... an Application window with a MenuBar and a ToolBar. Run it for Desktop, it works fine. Run it on android it works fine (the menu bar is integrated on the right of the toolbar.) However, when I add the ToolBarStyle to change the background of the toolbar, the menu is gone under android. This has got to be something simple, I've tried a gazillion googles and different permutations, but no joy. Has anyone got a clue on this one?

      import QtQuick 2.3
      import QtQuick.Controls 1.2
      import QtQuick.Layouts 1.1
      import QtQuick.Controls.Styles 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();
                  }
                  
              }
          }
          
          toolBar: ToolBar {
               // THIS STYLE CAUSES ANDROID MENU TO DISAPPEAR
              style: ToolBarStyle {
                  background: Rectangle {
                     color: "green"
                  }
              }
              RowLayout {
                  anchors.fill: parent
                  ToolButton {
                      text: "foo"
                  }
              }
              
          }
         
          Label {
              text: qsTr("Hello World")
              anchors.centerIn: parent
          }
      }
      
      
      bchimpB Offline
      bchimpB Offline
      bchimp
      wrote on last edited by
      #2

      ok this appears to be the same problem as this:
      https://forum.qt.io/topic/57647/qml-change-toolbar-color-one-style-property-only

      not really "solved", but at least some pointers in that previous post.

      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