mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 06:03:57 -06:00
Add toggle function to expandable popup
Also ensures that the machineSelector closes the popup on making a choice CURA-5785
This commit is contained in:
parent
f0b8c1e611
commit
eca9820fc4
2 changed files with 25 additions and 3 deletions
|
@ -40,6 +40,19 @@ Item
|
||||||
// Is the "drawer" open?
|
// Is the "drawer" open?
|
||||||
readonly property alias expanded: popup.visible
|
readonly property alias expanded: popup.visible
|
||||||
|
|
||||||
|
function togglePopup()
|
||||||
|
{
|
||||||
|
if(popup.visible)
|
||||||
|
{
|
||||||
|
popup.close()
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
popup.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
onPopupItemChanged:
|
onPopupItemChanged:
|
||||||
{
|
{
|
||||||
// Since we want the size of the popup to be set by the size of the content,
|
// Since we want the size of the popup to be set by the size of the content,
|
||||||
|
@ -100,7 +113,7 @@ Item
|
||||||
{
|
{
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: popup.visible ? popup.close() : popup.open()
|
onClicked: togglePopup()
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onEntered: background.color = headerHoverColor
|
onEntered: background.color = headerHoverColor
|
||||||
onExited: background.color = headerBackgroundColor
|
onExited: background.color = headerBackgroundColor
|
||||||
|
|
|
@ -77,8 +77,12 @@ Cura.ExpandableComponent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
onClicked: Cura.MachineManager.setActiveMachine(model.id)
|
|
||||||
radius: UM.Theme.getSize("default_radius").width
|
radius: UM.Theme.getSize("default_radius").width
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
togglePopup()
|
||||||
|
Cura.MachineManager.setActiveMachine(model.id)
|
||||||
|
}
|
||||||
|
|
||||||
Connections
|
Connections
|
||||||
{
|
{
|
||||||
|
@ -114,8 +118,13 @@ Cura.ExpandableComponent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
checked: Cura.MachineManager.activeMachineId == model.id
|
checked: Cura.MachineManager.activeMachineId == model.id
|
||||||
checkable: true
|
checkable: true
|
||||||
onClicked: Cura.MachineManager.setActiveMachine(model.id)
|
|
||||||
radius: UM.Theme.getSize("default_radius").width
|
radius: UM.Theme.getSize("default_radius").width
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
togglePopup()
|
||||||
|
Cura.MachineManager.setActiveMachine(model.id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue