summaryrefslogtreecommitdiffstats
path: root/src/controls/MenuBar.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-09-12 13:53:46 +0200
committerJ-P Nurmi <jpnurmi@digia.com>2014-09-15 11:42:48 +0200
commit238af2de1322007d0b74a9c9174e00024bf1cc1c (patch)
treecaaa2864a18603d47127312680c49207ead44013 /src/controls/MenuBar.qml
parent84d99bccfb7c627d83abe3c52a5a9d035f90c8d1 (diff)
Let MenuBarStyle control whether a native menubar is used
Change-Id: I1daecf82421ffa330d050430d6e54e4cc0122913 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/controls/MenuBar.qml')
-rw-r--r--src/controls/MenuBar.qml27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml
index 1896151f4..52b9cb423 100644
--- a/src/controls/MenuBar.qml
+++ b/src/controls/MenuBar.qml
@@ -84,6 +84,11 @@ MenuBarPrivate {
property Component style: Qt.createComponent(Settings.style + "/MenuBarStyle.qml", root)
/*! \internal */
+ property QtObject __style: styleLoader.item
+
+ __isNative: !__style.hasOwnProperty("__isNative") || __style.__isNative
+
+ /*! \internal */
__contentItem: Loader {
id: topLoader
sourceComponent: __menuBarComponent
@@ -92,6 +97,16 @@ MenuBarPrivate {
Keys.forwardTo: [item]
width: parent && active ? parent.width : 0
property bool altPressed: item ? item.__altPressed : false
+
+ Loader {
+ id: styleLoader
+ property alias __control: topLoader.item
+ sourceComponent: root.style
+ onStatusChanged: {
+ if (status === Loader.Error)
+ console.error("Failed to load Style for", root)
+ }
+ }
}
/*! \internal */
@@ -104,16 +119,6 @@ MenuBarPrivate {
visible: status === Loader.Ready
sourceComponent: d.style ? d.style.background : undefined
- Loader {
- id: styleLoader
- property alias __control: menuBarLoader
- sourceComponent: root.style
- onStatusChanged: {
- if (status === Loader.Error)
- console.error("Failed to load Style for", root)
- }
- }
-
width: root.__contentItem.width
height: Math.max(row.height + d.heightPadding, item ? item.implicitHeight : 0)
@@ -127,7 +132,7 @@ MenuBarPrivate {
QtObject {
id: d
- property Style style: styleLoader.item
+ property Style style: __style
property int openedMenuIndex: -1
property bool preselectMenuItem: false