From c1f2da8820794dea4f1c38b1124d9c77c0086bd4 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 11 Nov 2021 17:30:43 +0100 Subject: [PATCH] Layout fixes. Prevent 'height' based binding loops. part of CURA-8561 --- .../Marketplace/resources/qml/PackageCard.qml | 23 ++++++++----------- resources/qml/ToolTip.qml | 4 ++-- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 05a74de228..00f66751e3 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -12,7 +12,7 @@ Rectangle { property var packageData - width: parent ? parent.width : 0 + width: parent ? parent.width - UM.Theme.getSize("default_margin").width : 0 height: childrenRect.height color: UM.Theme.getColor("main_background") @@ -21,10 +21,11 @@ Rectangle RowLayout { 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 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. { @@ -38,7 +39,6 @@ Rectangle Column { Layout.fillWidth: true - Layout.preferredHeight: childrenRect.height Layout.alignment: Qt.AlignTop RowLayout //Title row. @@ -169,8 +169,6 @@ Rectangle Label { id: downloadCountLabel - anchors.left: downloadCountIcon.right - text: packageData.downloadCount } } @@ -248,13 +246,13 @@ Rectangle RowLayout //Author and action buttons. { width: parent.width - Layout.alignment: Qt.AlignBottom + Layout.alignment: Qt.AlignTop spacing: UM.Theme.getSize("thin_margin").width Label { id: authorBy - Layout.alignment: Qt.AlignBottom + Layout.alignment: Qt.AlignTop text: catalog.i18nc("@label", "By") font: UM.Theme.getFont("default") @@ -265,7 +263,7 @@ Rectangle { Layout.fillWidth: true Layout.preferredHeight: authorBy.height - Layout.alignment: Qt.AlignBottom + Layout.alignment: Qt.AlignTop text: packageData.authorName textFont: UM.Theme.getFont("default_bold") @@ -280,24 +278,21 @@ Rectangle Cura.SecondaryButton { - Layout.alignment: Qt.AlignBottom - Layout.preferredHeight: authorBy.height + Layout.alignment: Qt.AlignTop text: catalog.i18nc("@button", "Disable") // not functional right now } Cura.SecondaryButton { - Layout.alignment: Qt.AlignBottom - Layout.preferredHeight: authorBy.height + Layout.alignment: Qt.AlignTop text: catalog.i18nc("@button", "Uninstall") // not functional right now } Cura.PrimaryButton { - Layout.alignment: Qt.AlignBottom - Layout.preferredHeight: authorBy.height + Layout.alignment: Qt.AlignTop text: catalog.i18nc("@button", "Update") // not functional right now } diff --git a/resources/qml/ToolTip.qml b/resources/qml/ToolTip.qml index 3157f81d89..c4edc5a361 100644 --- a/resources/qml/ToolTip.qml +++ b/resources/qml/ToolTip.qml @@ -38,7 +38,7 @@ ToolTip onAboutToHide: hide() // 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: { @@ -74,7 +74,7 @@ ToolTip } function show() { - opacity = 1 + opacity = text != "" ? 1 : 0 } function hide() {