mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-29 22:01:14 -07:00
Adjust sizes and alignments to the print selector panel.
Contributes to CURA-5942.
This commit is contained in:
parent
23744e42d1
commit
8e47d04756
4 changed files with 35 additions and 22 deletions
|
|
@ -10,6 +10,13 @@ import UM 1.2 as UM
|
|||
Item
|
||||
{
|
||||
id: base
|
||||
|
||||
// Enumeration with the different possible alignments of the popup with respect of the headerItem
|
||||
enum PopupAlignment {
|
||||
AlignLeft,
|
||||
AlignRight
|
||||
}
|
||||
|
||||
// The headerItem holds the QML item that is always displayed.
|
||||
property alias headerItem: headerItemLoader.sourceComponent
|
||||
|
||||
|
|
@ -21,6 +28,9 @@ Item
|
|||
property color headerBackgroundColor: UM.Theme.getColor("action_button")
|
||||
property color headerHoverColor: UM.Theme.getColor("action_button_hovered")
|
||||
|
||||
// Defines the alignment of the popup with respect of the headerItem, by default to the right
|
||||
property int popupAlignment: ExpandableComponent.PopupAlignment.AlignRight
|
||||
|
||||
// How much spacing is needed around the popupItem
|
||||
property alias popupPadding: popup.padding
|
||||
|
||||
|
|
@ -42,6 +52,7 @@ Item
|
|||
|
||||
function togglePopup()
|
||||
{
|
||||
// print(popupAlignment, popupAlignment == PopupAlignment.AlignRight)
|
||||
if(popup.visible)
|
||||
{
|
||||
popup.close()
|
||||
|
|
@ -116,8 +127,8 @@ Item
|
|||
sourceSize.height: height
|
||||
visible: source != ""
|
||||
width: height
|
||||
height: 0.2 * base.height
|
||||
color: "black"
|
||||
height: Math.round(0.2 * base.height)
|
||||
color: UM.Theme.getColor("text")
|
||||
}
|
||||
|
||||
MouseArea
|
||||
|
|
@ -140,13 +151,15 @@ Item
|
|||
|
||||
// Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between
|
||||
// the button & text.
|
||||
x: -width + collapseButton.width + headerItemLoader.width + 3 * background.padding
|
||||
x: popupAlignment == ExpandableComponent.PopupAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0
|
||||
padding: UM.Theme.getSize("default_margin").width
|
||||
closePolicy: Popup.CloseOnPressOutsideParent
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
color: popupBackgroundColor
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: UM.Theme.getColor("lining")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue