mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Align the buttons at the bottom of the panel
Contributes to CURA-5941.
This commit is contained in:
parent
f67c725b2a
commit
bc8bf87809
2 changed files with 45 additions and 29 deletions
|
@ -163,6 +163,7 @@ Item
|
||||||
onExited: background.color = headerBackgroundColor
|
onExited: background.color = headerBackgroundColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DropShadow
|
DropShadow
|
||||||
{
|
{
|
||||||
id: shadow
|
id: shadow
|
||||||
|
@ -182,7 +183,7 @@ Item
|
||||||
id: popup
|
id: popup
|
||||||
|
|
||||||
// Ensure that the popup is located directly below the headerItem
|
// Ensure that the popup is located directly below the headerItem
|
||||||
y: headerItemLoader.height + 2 * background.padding + base.shadowOffset + popupSpacingY
|
y: background.height + base.shadowOffset + popupSpacingY
|
||||||
|
|
||||||
// Make the popup aligned with the rest, using the property popupAlignment to decide whether is right or left.
|
// Make the popup aligned with the rest, using the property popupAlignment to decide whether is right or left.
|
||||||
// In case of right alignment, the 3x padding is due to left, right and padding between the button & text.
|
// In case of right alignment, the 3x padding is due to left, right and padding between the button & text.
|
||||||
|
|
|
@ -11,7 +11,7 @@ Item
|
||||||
{
|
{
|
||||||
id: popup
|
id: popup
|
||||||
|
|
||||||
width: UM.Theme.getSize("print_setup_widget").width
|
width: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
|
|
||||||
property int currentModeIndex: -1
|
property int currentModeIndex: -1
|
||||||
|
@ -87,22 +87,50 @@ Item
|
||||||
color: UM.Theme.getColor("lining")
|
color: UM.Theme.getColor("lining")
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader
|
Item
|
||||||
{
|
{
|
||||||
id: loader
|
id: contents
|
||||||
width: parent.width
|
height: childrenRect.height
|
||||||
|
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
top: header.bottom
|
top: header.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
|
||||||
|
RecommendedPrintSetup
|
||||||
|
{
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
}
|
||||||
|
onShowTooltip: base.showTooltip(item, location, text)
|
||||||
|
onHideTooltip: base.hideTooltip()
|
||||||
|
visible: currentModeIndex == 0
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomPrintSetup
|
||||||
|
{
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
}
|
||||||
|
onShowTooltip: base.showTooltip(item, location, text)
|
||||||
|
onHideTooltip: base.hideTooltip()
|
||||||
|
visible: currentModeIndex == 1
|
||||||
}
|
}
|
||||||
sourceComponent: currentModeIndex == 0 ? recommendedPrintSetup : customPrintSetup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: buttonsSeparator
|
id: buttonsSeparator
|
||||||
|
|
||||||
anchors.top: loader.bottom
|
anchors.top: contents.bottom
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: UM.Theme.getSize("default_lining").height
|
height: UM.Theme.getSize("default_lining").height
|
||||||
color: UM.Theme.getColor("lining")
|
color: UM.Theme.getColor("lining")
|
||||||
|
@ -111,7 +139,8 @@ Item
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: buttonRow
|
id: buttonRow
|
||||||
height: childrenRect.height
|
property real padding: UM.Theme.getSize("default_margin").width
|
||||||
|
height: childrenRect.height + 2 * padding
|
||||||
|
|
||||||
// The buttonsSeparator is inside the buttonRow. This is to avoid some weird behaviours with the scroll bar.
|
// The buttonsSeparator is inside the buttonRow. This is to avoid some weird behaviours with the scroll bar.
|
||||||
anchors
|
anchors
|
||||||
|
@ -123,46 +152,32 @@ Item
|
||||||
|
|
||||||
Cura.SecondaryButton
|
Cura.SecondaryButton
|
||||||
{
|
{
|
||||||
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
anchors.margins: parent.padding
|
||||||
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", "Recommended")
|
text: catalog.i18nc("@button", "Recommended")
|
||||||
|
iconSource: UM.Theme.getIcon("arrow_left")
|
||||||
visible: currentModeIndex == 1
|
visible: currentModeIndex == 1
|
||||||
onClicked: currentModeIndex = 0
|
onClicked: currentModeIndex = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.SecondaryButton
|
Cura.SecondaryButton
|
||||||
{
|
{
|
||||||
|
anchors.top: parent.top
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||||
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", "Custom")
|
text: catalog.i18nc("@button", "Custom")
|
||||||
|
iconSource: UM.Theme.getIcon("arrow_right")
|
||||||
|
iconOnRightSide: true
|
||||||
visible: currentModeIndex == 0
|
visible: currentModeIndex == 0
|
||||||
onClicked: currentModeIndex = 1
|
onClicked: currentModeIndex = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component
|
|
||||||
{
|
|
||||||
id: recommendedPrintSetup
|
|
||||||
RecommendedPrintSetup
|
|
||||||
{
|
|
||||||
onShowTooltip: base.showTooltip(item, location, text)
|
|
||||||
onHideTooltip: base.hideTooltip()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component
|
|
||||||
{
|
|
||||||
id: customPrintSetup
|
|
||||||
CustomPrintSetup
|
|
||||||
{
|
|
||||||
onShowTooltip: base.showTooltip(item, location, text)
|
|
||||||
onHideTooltip: base.hideTooltip()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
var index = Math.round(UM.Preferences.getValue("cura/active_mode"))
|
var index = Math.round(UM.Preferences.getValue("cura/active_mode"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue