mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 23:23:57 -06:00
Define the look and feel of the view selector button. Adjust the sizes.
This commit is contained in:
parent
68c96a2577
commit
c5d0ed2651
2 changed files with 35 additions and 9 deletions
|
@ -15,7 +15,7 @@ Cura.ExpandableComponent
|
|||
property bool isPrinterConnected: Cura.MachineManager.printerConnected
|
||||
property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
||||
|
||||
popupPadding: 0
|
||||
popupPadding: UM.Theme.getSize("default_lining").width
|
||||
popupAlignment: Cura.ExpandableComponent.PopupAlignment.AlignLeft
|
||||
iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
||||
|
||||
|
@ -90,8 +90,7 @@ Cura.ExpandableComponent
|
|||
MachineSelectorList
|
||||
{
|
||||
// Can't use parent.width since the parent is the flickable component and not the ScrollView
|
||||
width: scroll.width - 2 * UM.Theme.getSize("default_lining").width
|
||||
x: UM.Theme.getSize("default_lining").width
|
||||
width: scroll.width
|
||||
property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height
|
||||
|
||||
onHeightChanged:
|
||||
|
|
|
@ -11,6 +11,8 @@ Cura.ExpandableComponent
|
|||
{
|
||||
id: viewSelector
|
||||
|
||||
popupPadding: UM.Theme.getSize("default_lining").width
|
||||
popupAlignment: Cura.ExpandableComponent.PopupAlignment.AlignLeft
|
||||
iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
||||
|
||||
property var viewModel: UM.ViewModel { }
|
||||
|
@ -71,25 +73,51 @@ Cura.ExpandableComponent
|
|||
popupItem: Column
|
||||
{
|
||||
id: viewSelectorPopup
|
||||
width: viewSelector.width - 2 * UM.Theme.getSize("default_margin").width
|
||||
width: viewSelector.width - 2 * viewSelector.popupPadding
|
||||
|
||||
// For some reason the height/width of the column gets set to 0 if this is not set...
|
||||
Component.onCompleted:
|
||||
{
|
||||
height = implicitHeight
|
||||
width = viewSelector.width - 2 * UM.Theme.getSize("default_margin").width
|
||||
width = viewSelector.width - 2 * viewSelector.popupPadding
|
||||
}
|
||||
|
||||
Repeater
|
||||
{
|
||||
id: viewsList
|
||||
model: viewSelector.viewModel
|
||||
RoundButton
|
||||
|
||||
delegate: Button
|
||||
{
|
||||
text: name
|
||||
radius: UM.Theme.getSize("default_radius").width
|
||||
id: viewsSelectorButton
|
||||
text: model.name
|
||||
width: parent.width
|
||||
height: UM.Theme.getSize("action_button").height
|
||||
leftPadding: UM.Theme.getSize("default_margin").width
|
||||
rightPadding: UM.Theme.getSize("default_margin").width
|
||||
checkable: true
|
||||
checked: viewSelector.activeView != null ? viewSelector.activeView.id == id : false
|
||||
|
||||
contentItem: Label
|
||||
{
|
||||
id: buttonText
|
||||
text: viewsSelectorButton.text
|
||||
color: UM.Theme.getColor("text")
|
||||
font: UM.Theme.getFont("action_button")
|
||||
renderType: Text.NativeRendering
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
id: backgroundRect
|
||||
color: viewsSelectorButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent"
|
||||
radius: UM.Theme.getSize("action_button_radius").width
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: viewsSelectorButton.checked ? UM.Theme.getColor("primary") : "transparent"
|
||||
}
|
||||
|
||||
onClicked:
|
||||
{
|
||||
viewSelector.togglePopup()
|
||||
|
@ -97,6 +125,5 @@ Cura.ExpandableComponent
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue