mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 18:59:10 +08:00
Merge remote-tracking branch 'origin/fix_long_button_text'
This commit is contained in:
commit
4f5aee6298
@ -40,6 +40,10 @@ Button
|
|||||||
// we elide the text to the right so the text will be cut off with the three dots at the end.
|
// 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
|
property var fixedWidthMode: false
|
||||||
|
|
||||||
|
// This property is used when the space for the button is limited. In case the button needs to grow with the text,
|
||||||
|
// but it can exceed a maximum, then this value have to be set.
|
||||||
|
property int maximumWidth: 0
|
||||||
|
|
||||||
leftPadding: UM.Theme.getSize("default_margin").width
|
leftPadding: UM.Theme.getSize("default_margin").width
|
||||||
rightPadding: UM.Theme.getSize("default_margin").width
|
rightPadding: UM.Theme.getSize("default_margin").width
|
||||||
height: UM.Theme.getSize("action_button").height
|
height: UM.Theme.getSize("action_button").height
|
||||||
@ -73,7 +77,7 @@ Button
|
|||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
height: parent.height
|
height: parent.height
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: fixedWidthMode ? button.width - button.leftPadding - button.rightPadding : undefined
|
width: fixedWidthMode ? button.width - button.leftPadding - button.rightPadding : ((maximumWidth != 0 && contentWidth > maximumWidth) ? maximumWidth : undefined)
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
@ -160,6 +160,9 @@ Cura.ExpandablePopup
|
|||||||
leftPadding: UM.Theme.getSize("default_margin").width
|
leftPadding: UM.Theme.getSize("default_margin").width
|
||||||
rightPadding: UM.Theme.getSize("default_margin").width
|
rightPadding: UM.Theme.getSize("default_margin").width
|
||||||
text: catalog.i18nc("@button", "Add printer")
|
text: catalog.i18nc("@button", "Add printer")
|
||||||
|
// The maximum width of the button is half of the total space, minus the padding of the parent, the left
|
||||||
|
// padding of the component and half the spacing because of the space between buttons.
|
||||||
|
maximumWidth: UM.Theme.getSize("machine_selector_widget_content").width / 2 - parent.padding - leftPadding - parent.spacing / 2
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
toggleContent()
|
toggleContent()
|
||||||
@ -172,6 +175,9 @@ Cura.ExpandablePopup
|
|||||||
leftPadding: UM.Theme.getSize("default_margin").width
|
leftPadding: UM.Theme.getSize("default_margin").width
|
||||||
rightPadding: UM.Theme.getSize("default_margin").width
|
rightPadding: UM.Theme.getSize("default_margin").width
|
||||||
text: catalog.i18nc("@button", "Manage printers")
|
text: catalog.i18nc("@button", "Manage printers")
|
||||||
|
// The maximum width of the button is half of the total space, minus the padding of the parent, the right
|
||||||
|
// padding of the component and half the spacing because of the space between buttons.
|
||||||
|
maximumWidth: UM.Theme.getSize("machine_selector_widget_content").width / 2 - parent.padding - rightPadding - parent.spacing / 2
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
toggleContent()
|
toggleContent()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user