Make the width of the ProfileWarningREset 0 when it is hidden.

Expand the profile selection dropdown when the ProfileWarningReset is hidden in the custom menu.
CURA-9793
This commit is contained in:
Joey de l'Arago 2022-12-06 18:11:15 +01:00
parent 4ecc0a98bb
commit 03fac1bc7f
2 changed files with 13 additions and 8 deletions

View file

@ -52,9 +52,13 @@ Item
id: intentSelection id: intentSelection
onClicked: menu.opened ? menu.close() : menu.open() onClicked: menu.opened ? menu.close() : menu.open()
anchors.right: profileWarningReset.left // Anchoring to the right makes much more sense here, but for some reason this component compresses from the right
anchors.rightMargin: UM.Theme.getSize("narrow_margin").width // and then expands from the left afterwards. This pushes it left by profileWarningReset.width
width: UM.Theme.getSize("print_setup_big_item").width - profileWarningReset.width // The solution is to anchor from the other direction so this does not happen.
anchors.left: parent.left
// This leftMargin gives us the same spacing as anchoring to the right on profileWarningReset
anchors.leftMargin: parent.width - UM.Theme.getSize("print_setup_big_item").width
width: profileWarningReset.visible ? UM.Theme.getSize("print_setup_big_item").width - profileWarningReset.width - UM.Theme.getSize("default_margin").width : UM.Theme.getSize("print_setup_big_item").width
height: textLabel.contentHeight + 2 * UM.Theme.getSize("narrow_margin").height height: textLabel.contentHeight + 2 * UM.Theme.getSize("narrow_margin").height
hoverEnabled: true hoverEnabled: true

View file

@ -13,7 +13,8 @@ Item
property bool fullWarning: true // <- Can you see the warning icon and the text, or is it just the buttons? property bool fullWarning: true // <- Can you see the warning icon and the text, or is it just the buttons?
height: visible ? UM.Theme.getSize("action_button_icon").height : 0 height: visible ? UM.Theme.getSize("action_button_icon").height : 0
visible: Cura.MachineManager.hasUserSettings || Cura.MachineManager.hasCustomQuality width: visible ? childrenRect.width: 0
visible: Cura.MachineManager.hasUserSettings || (fullWarning && Cura.MachineManager.hasCustomQuality)
Rectangle Rectangle
{ {
@ -46,7 +47,7 @@ Item
{ {
left: warningIcon.right left: warningIcon.right
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
leftMargin: UM.Theme.getSize("thin_margin").width leftMargin: visible ? UM.Theme.getSize("thin_margin").width : 0
} }
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
@ -113,7 +114,7 @@ Item
{ {
id: resetToDefaultQualityButton id: resetToDefaultQualityButton
height: UM.Theme.getSize("action_button_icon").height height: UM.Theme.getSize("action_button_icon").height
width: height width: visible ? height : 0
iconSource: UM.Theme.getIcon("ArrowReset") iconSource: UM.Theme.getIcon("ArrowReset")
anchors anchors
{ {
@ -141,7 +142,7 @@ Item
Item Item
{ {
id: buttonsSpacer id: buttonsSpacer
width: UM.Theme.getSize("default_margin").width width: compareAndSaveButton.visible ? UM.Theme.getSize("default_margin").width : 0
anchors.right: compareAndSaveButton.left anchors.right: compareAndSaveButton.left
} }
@ -149,7 +150,7 @@ Item
{ {
id: compareAndSaveButton id: compareAndSaveButton
height: UM.Theme.getSize("action_button_icon").height height: UM.Theme.getSize("action_button_icon").height
width: height width: visible ? height : 0
iconSource: UM.Theme.getIcon("Save") iconSource: UM.Theme.getIcon("Save")
anchors anchors
{ {