[frameworks/kirigami] src/forms/cards: FormEntry: don't show invalid leading ind trailing icons

Marco Martin <[email protected]> Wed, 5 Aug 2026 09:08:21 +0000 (UTC)
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit c3b7f4f914e34d6c59f67ec13a1c921bde70ff6f by Marco Martin.
Committed on 04/08/2026 at 08:33.
Pushed by mart into branch 'master'.

FormEntry: don't show invalid leading ind trailing icons

when items in leading and trailing areas are invisible
the layout width is 0, but there will be an extra space we don't want
so don't show the layout when its width is 0

M  +1    -0    src/forms/cards/FormAction.qml
M  +2    -2    src/forms/cards/FormEntry.qml

https://invent.kde.org/frameworks/kirigami/-/commit/c3b7f4f914e34d6c59f67ec13a1c921bde70ff6f

diff --git a/src/forms/cards/FormAction.qml b/src/forms/cards/FormAction.qml
index 2bea009bc..f7cc7bd70 100644
--- a/src/forms/cards/FormAction.qml
+++ b/src/forms/cards/FormAction.qml
@@ -20,6 +20,7 @@ FT.FormAction {
         Layout.fillHeight: true
         source: root.action.icon.name || root.action.icon.source
         color: root.action.icon.color
+        visible: valid
         Layout.preferredWidth: root.action.icon.width > 0 ? root.action.icon.width : Platform.Units.iconSizes.smallMedium
         Layout.preferredHeight: root.action.icon.height > 0 ? root.action.icon.height : Platform.Units.iconSizes.smallMedium
     }
diff --git a/src/forms/cards/FormEntry.qml b/src/forms/cards/FormEntry.qml
index 1ec8cbe86..89f4df906 100644
--- a/src/forms/cards/FormEntry.qml
+++ b/src/forms/cards/FormEntry.qml
@@ -130,7 +130,7 @@ FT.FormEntry {
             RowLayout {
                 id: leadingItems
                 Layout.rowSpan: subtitleLabel.visible ? 2 : 1
-                visible: children.length > 0
+                visible: children.length > 0 && width > 0
                 spacing: Platform.Units.smallSpacing
                 children: root.leadingItems
             }
@@ -162,7 +162,7 @@ FT.FormEntry {
                 id: trailingItems
                 Layout.rowSpan: subtitleLabel.visible ? 2 : 1
                 Layout.minimumWidth: visible ? implicitWidth : 0
-                visible: children.length > 0
+                visible: children.length > 0 && width > 0
                 spacing: Platform.Units.smallSpacing
                 children: root.trailingItems
             }