diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index d885253173..129c7dc923 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -40,6 +40,19 @@ Item // Is the "drawer" open? readonly property alias expanded: popup.visible + function togglePopup() + { + if(popup.visible) + { + popup.close() + } + else + { + popup.open() + } + } + + onPopupItemChanged: { // Since we want the size of the popup to be set by the size of the content, @@ -100,7 +113,7 @@ Item { id: mouseArea anchors.fill: parent - onClicked: popup.visible ? popup.close() : popup.open() + onClicked: togglePopup() hoverEnabled: true onEntered: background.color = headerHoverColor onExited: background.color = headerBackgroundColor diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index b2a34e186e..b18f427980 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -77,8 +77,12 @@ Cura.ExpandableComponent width: parent.width checkable: true - onClicked: Cura.MachineManager.setActiveMachine(model.id) radius: UM.Theme.getSize("default_radius").width + onClicked: + { + togglePopup() + Cura.MachineManager.setActiveMachine(model.id) + } Connections { @@ -114,8 +118,13 @@ Cura.ExpandableComponent width: parent.width checked: Cura.MachineManager.activeMachineId == model.id checkable: true - onClicked: Cura.MachineManager.setActiveMachine(model.id) + radius: UM.Theme.getSize("default_radius").width + onClicked: + { + togglePopup() + Cura.MachineManager.setActiveMachine(model.id) + } } }