Layout fixes.

Prevent 'height' based binding loops.

part of CURA-8561
This commit is contained in:
Remco Burema 2021-11-11 17:30:43 +01:00
parent 51de234082
commit c1f2da8820
No known key found for this signature in database
GPG Key ID: 215C49431D43F98C
2 changed files with 11 additions and 16 deletions

View File

@ -12,7 +12,7 @@ Rectangle
{ {
property var packageData property var packageData
width: parent ? parent.width : 0 width: parent ? parent.width - UM.Theme.getSize("default_margin").width : 0
height: childrenRect.height height: childrenRect.height
color: UM.Theme.getColor("main_background") color: UM.Theme.getColor("main_background")
@ -21,10 +21,11 @@ Rectangle
RowLayout RowLayout
{ {
width: parent.width - UM.Theme.getSize("thin_margin").width * 2 width: parent.width - UM.Theme.getSize("thin_margin").width * 2
height: childrenRect.height + UM.Theme.getSize("thin_margin").height * 2
x: UM.Theme.getSize("thin_margin").width x: UM.Theme.getSize("thin_margin").width
y: UM.Theme.getSize("thin_margin").height y: UM.Theme.getSize("thin_margin").height
spacing: UM.Theme.getSize("thin_margin").width spacing: UM.Theme.getSize("default_margin").width
Image //Separate column for icon on the left. Image //Separate column for icon on the left.
{ {
@ -38,7 +39,6 @@ Rectangle
Column Column
{ {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: childrenRect.height
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
RowLayout //Title row. RowLayout //Title row.
@ -169,8 +169,6 @@ Rectangle
Label Label
{ {
id: downloadCountLabel id: downloadCountLabel
anchors.left: downloadCountIcon.right
text: packageData.downloadCount text: packageData.downloadCount
} }
} }
@ -248,13 +246,13 @@ Rectangle
RowLayout //Author and action buttons. RowLayout //Author and action buttons.
{ {
width: parent.width width: parent.width
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignTop
spacing: UM.Theme.getSize("thin_margin").width spacing: UM.Theme.getSize("thin_margin").width
Label Label
{ {
id: authorBy id: authorBy
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignTop
text: catalog.i18nc("@label", "By") text: catalog.i18nc("@label", "By")
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
@ -265,7 +263,7 @@ Rectangle
{ {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: authorBy.height Layout.preferredHeight: authorBy.height
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignTop
text: packageData.authorName text: packageData.authorName
textFont: UM.Theme.getFont("default_bold") textFont: UM.Theme.getFont("default_bold")
@ -280,24 +278,21 @@ Rectangle
Cura.SecondaryButton Cura.SecondaryButton
{ {
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignTop
Layout.preferredHeight: authorBy.height
text: catalog.i18nc("@button", "Disable") text: catalog.i18nc("@button", "Disable")
// not functional right now // not functional right now
} }
Cura.SecondaryButton Cura.SecondaryButton
{ {
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignTop
Layout.preferredHeight: authorBy.height
text: catalog.i18nc("@button", "Uninstall") text: catalog.i18nc("@button", "Uninstall")
// not functional right now // not functional right now
} }
Cura.PrimaryButton Cura.PrimaryButton
{ {
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignTop
Layout.preferredHeight: authorBy.height
text: catalog.i18nc("@button", "Update") text: catalog.i18nc("@button", "Update")
// not functional right now // not functional right now
} }

View File

@ -38,7 +38,7 @@ ToolTip
onAboutToHide: hide() onAboutToHide: hide()
// If the text is not set, just set the height to 0 to prevent it from showing // If the text is not set, just set the height to 0 to prevent it from showing
height: text != "" ? label.contentHeight + 2 * UM.Theme.getSize("thin_margin").width: 0 height: label.contentHeight + 2 * UM.Theme.getSize("thin_margin").width
x: x:
{ {
@ -74,7 +74,7 @@ ToolTip
} }
function show() { function show() {
opacity = 1 opacity = text != "" ? 1 : 0
} }
function hide() { function hide() {