From d526e3be8cca3e2240608a8ad6350f88327a63f8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 9 Nov 2021 17:40:10 +0100 Subject: [PATCH] Easier layout shifting when icons are invisible The Row element automatically hides them and removes any spacing if they are invisible. Contributes to issue CURA-8561. --- .../Marketplace/resources/qml/PackageCard.qml | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 61632de3ef..ab26699ce8 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -59,26 +59,31 @@ Rectangle color: UM.Theme.getColor("text") } - UM.RecolorImage + Row //Row inside row, but the non-layout version skips invisible elements. { - Layout.preferredWidth: visible ? UM.Theme.getSize("section_icon").width : 0 - Layout.preferredHeight: visible ? UM.Theme.getSize("section_icon").height : 0 + spacing: parent.spacing Layout.alignment: Qt.AlignTop - color: UM.Theme.getColor("icon") - visible: packageData.isVerified - source: UM.Theme.getIcon("CheckCircle") + UM.RecolorImage + { + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height - // TODO: on hover - } + color: UM.Theme.getColor("icon") + visible: packageData.isVerified + source: UM.Theme.getIcon("CheckCircle") - Rectangle - { // placeholder for 'certified material' icon+link whenever we implement the materials part of this card - Layout.preferredWidth: visible ? UM.Theme.getSize("section_icon").width : 0 - Layout.preferredHeight: visible ? UM.Theme.getSize("section_icon").height : 0 - Layout.alignment: Qt.AlignTop + // TODO: on hover + } - // TODO: on hover + Rectangle + { // placeholder for 'certified material' icon+link whenever we implement the materials part of this card + width: UM.Theme.getSize("section_icon").width + height: UM.Theme.getSize("section_icon").height + + visible: false + // TODO: on hover + } } Label