mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-13 16:53:13 +08:00
Fix sizing behaviour of Save button
Use the text size with some margin for the button size and simply anchor it to the right drop down button.
This commit is contained in:
parent
222b4666d3
commit
fa907dfb1b
@ -74,13 +74,14 @@ Rectangle {
|
|||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: saveToButton
|
id: saveToButton
|
||||||
property int resizedWidth
|
|
||||||
x: base.width - saveToButton.resizedWidth - UM.Theme.getSize("default_margin").width - UM.Theme.getSize("save_button_save_to_button").height + UM.Theme.getSize("save_button_save_to_button").width
|
|
||||||
tooltip: UM.OutputDeviceManager.activeDeviceDescription;
|
tooltip: UM.OutputDeviceManager.activeDeviceDescription;
|
||||||
enabled: base.backendState == 2 && base.activity == true
|
enabled: base.backendState == 2 && base.activity == true
|
||||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||||
width: 150
|
|
||||||
anchors.top:parent.top
|
anchors.top:parent.top
|
||||||
|
anchors.right: deviceSelectionMenu.left;
|
||||||
|
|
||||||
text: UM.OutputDeviceManager.activeDeviceShortDescription
|
text: UM.OutputDeviceManager.activeDeviceShortDescription
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
@ -88,9 +89,9 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
style: ButtonStyle {
|
style: ButtonStyle {
|
||||||
background: Rectangle {
|
background:
|
||||||
//opacity: control.enabled ? 1.0 : 0.5
|
Rectangle
|
||||||
//Behavior on opacity { NumberAnimation { duration: 50; } }
|
{
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") :
|
border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") :
|
||||||
control.pressed ? UM.Theme.getColor("action_button_active_border") :
|
control.pressed ? UM.Theme.getColor("action_button_active_border") :
|
||||||
@ -99,13 +100,11 @@ Rectangle {
|
|||||||
control.pressed ? UM.Theme.getColor("action_button_active") :
|
control.pressed ? UM.Theme.getColor("action_button_active") :
|
||||||
control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
|
control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
|
||||||
Behavior on color { ColorAnimation { duration: 50; } }
|
Behavior on color { ColorAnimation { duration: 50; } }
|
||||||
width: {
|
|
||||||
saveToButton.resizedWidth = actualLabel.width + (UM.Theme.getSize("default_margin").width * 2)
|
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2)
|
||||||
return saveToButton.resizedWidth
|
|
||||||
}
|
|
||||||
Label {
|
Label {
|
||||||
id: actualLabel
|
id: actualLabel
|
||||||
//Behavior on opacity { NumberAnimation { duration: 50; } }
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") :
|
color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") :
|
||||||
control.pressed ? UM.Theme.getColor("action_button_active_text") :
|
control.pressed ? UM.Theme.getColor("action_button_active_text") :
|
||||||
@ -155,7 +154,8 @@ Rectangle {
|
|||||||
sourceSize.width: width
|
sourceSize.width: width
|
||||||
sourceSize.height: height
|
sourceSize.height: height
|
||||||
color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") :
|
color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") :
|
||||||
control.pressed ? UM.Theme.getColor("action_button_active_text") : control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text");
|
control.pressed ? UM.Theme.getColor("action_button_active_text") :
|
||||||
|
control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text");
|
||||||
source: UM.Theme.getIcon("arrow_bottom");
|
source: UM.Theme.getIcon("arrow_bottom");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user