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)
Forum Updated to NodeBB v4.3 + New Features

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 1 Watching
  • 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.
  • B Offline
    B Offline
    bchimp
    wrote on 12 Apr 2016, 00:51 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
        }
    }
    
    
    B 1 Reply Last reply 12 Apr 2016, 14:43
    0
    • B bchimp
      12 Apr 2016, 00:51

      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
          }
      }
      
      
      B Offline
      B Offline
      bchimp
      wrote on 12 Apr 2016, 14:43 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

      2/2

      12 Apr 2016, 14:43

      • Login

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