From d47806de509d9aeeeebff5c5c410fb17ab35f26d Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 27 Nov 2018 15:05:35 +0100 Subject: [PATCH] Change style, added close popitem close behaviour CURA-5941 --- resources/qml/ExpandableComponent.qml | 3 +++ resources/qml/PrintSetupSelector.qml | 37 ++++++++++++-------------- resources/themes/cura-light/theme.json | 2 -- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 3b1105ddd6..707b947c7f 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -49,6 +49,9 @@ Item // On what side should the header corners be shown? 1 is down, 2 is left, 3 is up and 4 is right. property alias headerCornerSide: background.cornerSide + // Change the popupItem close behaviour + property alias popupClosePolicy : popup.closePolicy + function togglePopup() { if(popup.visible) diff --git a/resources/qml/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector.qml index 371232372d..b20d8e116b 100644 --- a/resources/qml/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector.qml @@ -29,7 +29,9 @@ Cura.ExpandableComponent iconSource: UM.Theme.getIcon("pencil") popupPadding : 0 - popupSpacingY: 10 + popupSpacingY: UM.Theme.getSize("narrow_margin").width + + popupClosePolicy: Popup.CloseOnEscape onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) @@ -124,7 +126,7 @@ Cura.ExpandableComponent popupItem: Rectangle { - property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("print_setup_selector_margin").height * 2 + property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("narrow_margin").height * 2 id: popupItemWrapper height: total_height @@ -157,7 +159,7 @@ Cura.ExpandableComponent { topMargin: UM.Theme.getSize("sidebar_margin").height left: parent.left - leftMargin: UM.Theme.getSize("print_setup_selector_margin").height + leftMargin: UM.Theme.getSize("narrow_margin").height } } @@ -194,7 +196,7 @@ Cura.ExpandableComponent source: UM.Theme.getIcon("cross1") } - onClicked: base.model.hideMessage(model.id) + onClicked: base.togglePopup() // Will hide the popup item background: Rectangle { @@ -211,17 +213,16 @@ Cura.ExpandableComponent anchors { top: popupItemHeader.bottom - topMargin: UM.Theme.getSize("print_setup_selector_margin").height + topMargin: UM.Theme.getSize("narrow_margin").height right: parent.right left: parent.left - leftMargin: 5 - rightMargin: 5 + leftMargin: UM.Theme.getSize("thick_margin").width / 1.5 + rightMargin: UM.Theme.getSize("thick_margin").width / 1.5 } UM.TabRow { id: tabBar - anchors.top: popupItemHeader.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) z: 1 @@ -309,7 +310,7 @@ Cura.ExpandableComponent { id: footerControll anchors.top: popupItemContent.bottom - anchors.topMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 + anchors.topMargin: UM.Theme.getSize("narrow_margin").height * 2 width: parent.width height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4 Rectangle @@ -337,10 +338,10 @@ Cura.ExpandableComponent anchors { top: parent.top - topMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 - bottomMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 + topMargin: UM.Theme.getSize("narrow_margin").height * 2 + bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 right: parent.right - rightMargin: UM.Theme.getSize("print_setup_selector_margin").height + rightMargin: UM.Theme.getSize("narrow_margin").height } onClicked: currentModeIndex = 1 @@ -361,19 +362,15 @@ Cura.ExpandableComponent anchors { top: parent.top - topMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 - bottomMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 + topMargin: UM.Theme.getSize("narrow_margin").height * 2 + bottomMargin: UM.Theme.getSize("narrow_margin").height * 2 left: parent.left - leftMargin: UM.Theme.getSize("print_setup_selector_margin").height + leftMargin: UM.Theme.getSize("narrow_margin").height } -// onClicked: currentModeIndex = 0 MouseArea { anchors.fill: parent - onClicked: { - currentModeIndex = 0 - - } + onClicked: currentModeIndex = 0 } } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index e6889b50c0..1228e52b9d 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -535,9 +535,7 @@ "monitor_shadow_radius": [0.4, 0.4], "monitor_shadow_offset": [0.15, 0.15], - "print_setup_selector_margin": [0.5, 0.5], "print_setup_action_button": [13, 5], - "print_setup_tap_bar": [4, 4], "print_setup_content_top_margin": [3, 3] } }