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.
This commit is contained in:
Ghostkeeper 2021-11-09 17:40:10 +01:00
parent f498952830
commit d526e3be8c
No known key found for this signature in database
GPG Key ID: 68F39EA88EEED5FF

View File

@ -59,11 +59,15 @@ Rectangle
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
} }
Row //Row inside row, but the non-layout version skips invisible elements.
{
spacing: parent.spacing
Layout.alignment: Qt.AlignTop
UM.RecolorImage UM.RecolorImage
{ {
Layout.preferredWidth: visible ? UM.Theme.getSize("section_icon").width : 0 width: UM.Theme.getSize("section_icon").width
Layout.preferredHeight: visible ? UM.Theme.getSize("section_icon").height : 0 height: UM.Theme.getSize("section_icon").height
Layout.alignment: Qt.AlignTop
color: UM.Theme.getColor("icon") color: UM.Theme.getColor("icon")
visible: packageData.isVerified visible: packageData.isVerified
@ -74,12 +78,13 @@ Rectangle
Rectangle Rectangle
{ // placeholder for 'certified material' icon+link whenever we implement the materials part of this card { // 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 width: UM.Theme.getSize("section_icon").width
Layout.preferredHeight: visible ? UM.Theme.getSize("section_icon").height : 0 height: UM.Theme.getSize("section_icon").height
Layout.alignment: Qt.AlignTop
visible: false
// TODO: on hover // TODO: on hover
} }
}
Label Label
{ {