on xenial help sign in
Remove unclickable gaps on the menubar (LP: #1672722)
b1b726eAlbert Astals Cid
qml/ApplicationMenus/MenuBar.qml+12−6
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2016 Canonical Ltd.
2+ * Copyright 2016, 2017 Canonical Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
5 * it under the terms of the GNU Lesser General Public License as published by
@@ -90,7 +90,7 @@ Item {
90
90
91 Row {
91 Row {
92 id: row
92 id: row
93− spacing: units.gu(2)
93+ spacing: 0
94 height: parent.height
94 height: parent.height
95
95
96 ActionContext {
96 ActionContext {
@@ -125,7 +125,11 @@ Item {
125 readonly property bool shouldDisplay: x + width + ((__ownIndex < rowRepeater.count-1) ? units.gu(2) : 0) <
125 readonly property bool shouldDisplay: x + width + ((__ownIndex < rowRepeater.count-1) ? units.gu(2) : 0) <
126 root.overflowWidth - ((__ownIndex < rowRepeater.count-1) ? overflowButton.width : 0)
126 root.overflowWidth - ((__ownIndex < rowRepeater.count-1) ? overflowButton.width : 0)
127
127
128+ // First item is not centered, it has 0 gu on the left and 1 on the right
129+ // so needs different width and anchors
130+ readonly property bool isFirstItem: __ownIndex == 0
131+
128− implicitWidth: column.implicitWidth
132+ implicitWidth: column.implicitWidth + (isFirstItem ? units.gu(1) : units.gu(2))
129 implicitHeight: row.height
133 implicitHeight: row.height
130 enabled: (model.sensitive === true) && shouldDisplay
134 enabled: (model.sensitive === true) && shouldDisplay
131 opacity: shouldDisplay ? 1 : 0
135 opacity: shouldDisplay ? 1 : 0
@@ -189,7 +193,9 @@ Item {
189 id: column
193 id: column
190 spacing: units.gu(1)
194 spacing: units.gu(1)
191 anchors {
195 anchors {
192− centerIn: parent
196+ verticalCenter: parent.verticalCenter
197+ horizontalCenter: !visualItem.isFirstItem ? parent.horizontalCenter : undefined
198+ left: visualItem.isFirstItem ? parent.left : undefined
193 }
199 }
194
200
195 Icon {
201 Icon {
@@ -385,8 +391,8 @@ Item {
385 anchors {
391 anchors {
386 bottom: row.bottom
392 bottom: row.bottom
387 }
393 }
388− x: d.currentItem ? row.x + d.currentItem.x - units.gu(1) : 0
394+ x: d.currentItem ? row.x + d.currentItem.x : 0
389− width: d.currentItem ? d.currentItem.width + units.gu(2) : 0
395+ width: d.currentItem ? d.currentItem.width : 0
390 height: units.dp(4)
396 height: units.dp(4)
391 color: UbuntuColors.orange
397 color: UbuntuColors.orange
392 visible: d.currentItem
398 visible: d.currentItem