From 3dc67f387f63f82fbb9216f04c8f13039b5e243a Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Fri, 1 Apr 2022 11:12:30 +0200 Subject: [PATCH 1/2] Height based on implicitHeight/implicitWidth now. Removed redundant code. CURA-8640 --- resources/qml/ExpandableComponent.qml | 22 ------------------- .../PrintSetupSelectorContents.qml | 5 ++--- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index e5eab3bd93..3742c6d5e5 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -305,28 +305,6 @@ Item padding: UM.Theme.getSize("default_margin").width contentItem: Item {} - - onContentItemChanged: - { - // Since we want the size of the content to be set by the size of the content, - // we need to do it like this. - content.width = contentItem.width + 2 * content.padding - content.height = contentItem.height + 2 * content.padding - } - } - } - - // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. - // Apparently the order in which these are handled matters and so the height is correctly updated if this is here. - Connections - { - // Since it could be that the content is dynamically populated, we should also take these changes into account. - target: content.contentItem - function onWidthChanged() { content.width = content.contentItem.width + 2 * content.padding } - function onHeightChanged() - { - content.height = content.contentItem.height + 2 * content.padding - contentContainer.height = contentHeader.height + content.height } } } diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 046efe8b5b..69261033eb 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -15,9 +15,8 @@ Item id: content property int absoluteMinimumHeight: 200 * screenScaleFactor - - width: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width - height: contents.height + buttonRow.height + implicitWidth: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width + implicitHeight: contents.height + buttonRow.height enum Mode { From e40a219b53d5ae414bea28fec3b14903aea573e2 Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Fri, 1 Apr 2022 11:36:22 +0200 Subject: [PATCH 2/2] Add back code for resizing contentContainer. This makes sure that the background get smaller when the setting container is resized. CURA-8640 --- resources/qml/ExpandableComponent.qml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 3742c6d5e5..6717be94a5 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -307,4 +307,16 @@ Item contentItem: Item {} } } + + // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. + // Apparently the order in which these are handled matters and so the height is correctly updated if this is here. + Connections + { + // Since it could be that the content is dynamically populated, we should also take these changes into account. + target: content.contentItem + function onHeightChanged() + { + contentContainer.height = contentHeader.height + content.height + } + } }