From 7331c1fa1c22c4757e95acd192cd7a0aaa60356d Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 21 Aug 2019 16:41:52 -0400 Subject: [PATCH] MenuItem: don't take space when not visible --- src/qml/Base/HMenu.qml | 4 +++- src/qml/Base/HMenuItem.qml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qml/Base/HMenu.qml b/src/qml/Base/HMenu.qml index f96ba127..8e96d896 100644 --- a/src/qml/Base/HMenu.qml +++ b/src/qml/Base/HMenu.qml @@ -11,7 +11,9 @@ Menu { let rightPadding = 0 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) leftPadding = Math.max(item.leftPadding, leftPadding) rightPadding = Math.max(item.rightPadding, rightPadding) diff --git a/src/qml/Base/HMenuItem.qml b/src/qml/Base/HMenuItem.qml index 42012f5c..7be5ee4b 100644 --- a/src/qml/Base/HMenuItem.qml +++ b/src/qml/Base/HMenuItem.qml @@ -8,6 +8,7 @@ MenuItem { rightPadding: spacing topPadding: spacing / 1.75 bottomPadding: spacing / 1.75 + height: visible ? implicitHeight : 0 readonly property alias iconItem: contentItem.icon