MenuItem: don't take space when not visible

This commit is contained in:
miruka 2019-08-21 16:41:52 -04:00
parent 26b01be23c
commit 7331c1fa1c
2 changed files with 4 additions and 1 deletions

View File

@ -11,7 +11,9 @@ Menu {
let rightPadding = 0 let rightPadding = 0
for (let i = 0; i < count; ++i) { for (let i = 0; i < count; ++i) {
let item = itemAt(i) let item = itemAt(i)
if (! item.visible) continue
result = Math.max(item.contentItem.implicitWidth, result) result = Math.max(item.contentItem.implicitWidth, result)
leftPadding = Math.max(item.leftPadding, leftPadding) leftPadding = Math.max(item.leftPadding, leftPadding)
rightPadding = Math.max(item.rightPadding, rightPadding) rightPadding = Math.max(item.rightPadding, rightPadding)

View File

@ -8,6 +8,7 @@ MenuItem {
rightPadding: spacing rightPadding: spacing
topPadding: spacing / 1.75 topPadding: spacing / 1.75
bottomPadding: spacing / 1.75 bottomPadding: spacing / 1.75
height: visible ? implicitHeight : 0
readonly property alias iconItem: contentItem.icon readonly property alias iconItem: contentItem.icon