mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Add a new property to the ActionButton to indicate whether the button
has a fixed width or the width will be dependant on the content. Contributes to CURA-5786.
This commit is contained in:
parent
b6b60702c0
commit
5dddcbd666
5 changed files with 13 additions and 0 deletions
|
@ -21,6 +21,7 @@ Row
|
||||||
textColor: UM.Theme.getColor("main_window_header_button_text_active")
|
textColor: UM.Theme.getColor("main_window_header_button_text_active")
|
||||||
textHoverColor: UM.Theme.getColor("main_window_header_button_text_active")
|
textHoverColor: UM.Theme.getColor("main_window_header_button_text_active")
|
||||||
onClicked: Qt.openUrlExternally("https://account.ultimaker.com")
|
onClicked: Qt.openUrlExternally("https://account.ultimaker.com")
|
||||||
|
fixedWidthMode: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.ActionButton
|
Cura.ActionButton
|
||||||
|
@ -29,5 +30,6 @@ Row
|
||||||
height: UM.Theme.getSize("account_button").height
|
height: UM.Theme.getSize("account_button").height
|
||||||
text: catalog.i18nc("@button", "Login")
|
text: catalog.i18nc("@button", "Login")
|
||||||
onClicked: Cura.API.account.login()
|
onClicked: Cura.API.account.login()
|
||||||
|
fixedWidthMode: true
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,6 +21,7 @@ Row
|
||||||
textColor: UM.Theme.getColor("main_window_header_button_text_active")
|
textColor: UM.Theme.getColor("main_window_header_button_text_active")
|
||||||
textHoverColor: UM.Theme.getColor("main_window_header_button_text_active")
|
textHoverColor: UM.Theme.getColor("main_window_header_button_text_active")
|
||||||
onClicked: Qt.openUrlExternally("https://account.ultimaker.com")
|
onClicked: Qt.openUrlExternally("https://account.ultimaker.com")
|
||||||
|
fixedWidthMode: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.ActionButton
|
Cura.ActionButton
|
||||||
|
@ -29,5 +30,6 @@ Row
|
||||||
height: UM.Theme.getSize("account_button").height
|
height: UM.Theme.getSize("account_button").height
|
||||||
text: catalog.i18nc("@button", "Logout")
|
text: catalog.i18nc("@button", "Logout")
|
||||||
onClicked: Cura.API.account.logout()
|
onClicked: Cura.API.account.logout()
|
||||||
|
fixedWidthMode: true
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,6 +24,10 @@ Button
|
||||||
property var outlineColor: color
|
property var outlineColor: color
|
||||||
property var outlineHoverColor: hoverColor
|
property var outlineHoverColor: hoverColor
|
||||||
property var outlineDisabledColor: outlineColor
|
property var outlineDisabledColor: outlineColor
|
||||||
|
// This property is used to indicate whether the button has a fixed width or the width would depend on the contents
|
||||||
|
// Be careful when using fixedWidthMode, the translated texts can be too long that they won't fit. In any case,
|
||||||
|
// we elide the text to the right so the text will be cut off with the three dots at the end.
|
||||||
|
property var fixedWidthMode: false
|
||||||
|
|
||||||
contentItem: Row
|
contentItem: Row
|
||||||
{
|
{
|
||||||
|
@ -50,6 +54,9 @@ Button
|
||||||
visible: text != ""
|
visible: text != ""
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: fixedWidthMode ? button.width - button.leftPadding - button.rightPadding : undefined
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ Item
|
||||||
{
|
{
|
||||||
id: saveToButton
|
id: saveToButton
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
fixedWidthMode: true
|
||||||
|
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,6 +86,7 @@ Column
|
||||||
id: prepareButton
|
id: prepareButton
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: UM.Theme.getSize("action_panel_button").height
|
height: UM.Theme.getSize("action_panel_button").height
|
||||||
|
fixedWidthMode: true
|
||||||
text:
|
text:
|
||||||
{
|
{
|
||||||
if ([UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) != -1)
|
if ([UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) != -1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue