From f483f04763ebbb119397c8bfdb00c3893d95e6fa Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 9 May 2022 11:54:28 +0200 Subject: [PATCH 1/3] Set the width of model loading drop-down to the max of all elements Then set the elements to be equal to that width, so they fill the complete width of the drop-down. Contributes to issue CURA-9143. --- plugins/PrepareStage/PrepareMenu.qml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index d6bff1792e..42c3c8dde6 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -106,26 +106,34 @@ Item { id: openProviderColumn - //The column doesn't automatically listen to its children rect if the children change internally, so we need to explicitly update the size. - onChildrenRectChanged: + // Automatically set the width to fit the widest MenuItem + // Based on https://martin.rpdev.net/2018/03/13/qt-quick-controls-2-automatically-set-the-width-of-menus.html + function setWidth() { - popup.implicitHeight = childrenRect.height - popup.implicitWidth = childrenRect.width - } - onPositioningComplete: - { - popup.implicitHeight = childrenRect.height - popup.implicitWidth = childrenRect.width + var result = 0; + var padding = 0; + for (var i = 0; i < fileProviderRepeater.count; ++i) { + var item = fileProviderRepeater.itemAt(i); + if (item.hasOwnProperty("implicitWidth")) + { + var itemWidth = item.implicitWidth; + result = Math.max(itemWidth, result); + padding = Math.max(item.padding, padding); + } + } + return result + padding * 2; } + width: setWidth() Repeater { + id: fileProviderRepeater model: prepareMenu.fileProviderModel delegate: Button { leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width - width: contentItem.width + leftPadding + rightPadding + width: openProviderColumn.width height: UM.Theme.getSize("action_button").height hoverEnabled: true From 815a0b4014af27af6906c78ec9d5162e169cfbdb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 9 May 2022 11:59:00 +0200 Subject: [PATCH 2/3] Make buttons in account fill the whole width That makes them easier to click. The text of these buttons was going outside of the buttons themselves. That could be a problem, but it's not visible since the button has no background. Contributes to issue CURA-9143. --- resources/qml/Account/UserOperations.qml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/resources/qml/Account/UserOperations.qml b/resources/qml/Account/UserOperations.qml index c8642681ae..9e5d082738 100644 --- a/resources/qml/Account/UserOperations.qml +++ b/resources/qml/Account/UserOperations.qml @@ -90,8 +90,9 @@ Column Cura.TertiaryButton { id: cloudButton - width: UM.Theme.getSize("account_button").width + width: parent.width height: UM.Theme.getSize("account_button").height + text: "Ultimaker Digital Factory" onClicked: Qt.openUrlExternally(CuraApplication.ultimakerDigitalFactoryUrl + "?utm_source=cura&utm_medium=software&utm_campaign=menu-visit-DF") fixedWidthMode: false @@ -100,8 +101,9 @@ Column Cura.TertiaryButton { id: accountButton - width: UM.Theme.getSize("account_button").width + width: parent.width height: UM.Theme.getSize("account_button").height + text: catalog.i18nc("@button", "Ultimaker Account") onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "?utm_source=cura&utm_medium=software&utm_campaign=menu-visit-account") fixedWidthMode: false @@ -117,7 +119,11 @@ Column Cura.TertiaryButton { id: signOutButton + width: parent.width + height: UM.Theme.getSize("account_button").height + onClicked: Cura.API.account.logout() text: catalog.i18nc("@button", "Sign Out") + fixedWidthMode: false } } From efdb21b7a18cd96fae78750de6bfca1fdc5dc954 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 9 May 2022 17:12:00 +0200 Subject: [PATCH 3/3] Don't override size of extruder icons Just let them be the default size of Cura.ExtruderIcon, which is the only correct size. It is already properly centred in the tab, too. Contributes to issue CURA-9180. --- resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index 41bf28be15..5e4303c15c 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -218,8 +218,6 @@ Item materialColor: model.color extruderEnabled: model.enabled iconVariant: "default" - height: parent.height - width: height } } onClicked: