QML ToolBarStyle hides Android Menu (Qt 5.5.1)
-
wrote on 12 Apr 2016, 00:51 last edited by
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 } }
-
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 } }
wrote on 12 Apr 2016, 14:43 last edited byok this appears to be the same problem as this:
https://forum.qt.io/topic/57647/qml-change-toolbar-color-one-style-property-onlynot really "solved", but at least some pointers in that previous post.
1/2