Change style, added close popitem close behaviour

CURA-5941
This commit is contained in:
Aleksei S 2018-11-27 15:05:35 +01:00
parent 8784ecd49a
commit d47806de50
3 changed files with 20 additions and 22 deletions

View File

@ -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. // 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 property alias headerCornerSide: background.cornerSide
// Change the popupItem close behaviour
property alias popupClosePolicy : popup.closePolicy
function togglePopup() function togglePopup()
{ {
if(popup.visible) if(popup.visible)

View File

@ -29,7 +29,9 @@ Cura.ExpandableComponent
iconSource: UM.Theme.getIcon("pencil") iconSource: UM.Theme.getIcon("pencil")
popupPadding : 0 popupPadding : 0
popupSpacingY: 10 popupSpacingY: UM.Theme.getSize("narrow_margin").width
popupClosePolicy: Popup.CloseOnEscape
onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex) onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex)
@ -124,7 +126,7 @@ Cura.ExpandableComponent
popupItem: Rectangle 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 id: popupItemWrapper
height: total_height height: total_height
@ -157,7 +159,7 @@ Cura.ExpandableComponent
{ {
topMargin: UM.Theme.getSize("sidebar_margin").height topMargin: UM.Theme.getSize("sidebar_margin").height
left: parent.left 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") source: UM.Theme.getIcon("cross1")
} }
onClicked: base.model.hideMessage(model.id) onClicked: base.togglePopup() // Will hide the popup item
background: Rectangle background: Rectangle
{ {
@ -211,17 +213,16 @@ Cura.ExpandableComponent
anchors anchors
{ {
top: popupItemHeader.bottom top: popupItemHeader.bottom
topMargin: UM.Theme.getSize("print_setup_selector_margin").height topMargin: UM.Theme.getSize("narrow_margin").height
right: parent.right right: parent.right
left: parent.left left: parent.left
leftMargin: 5 leftMargin: UM.Theme.getSize("thick_margin").width / 1.5
rightMargin: 5 rightMargin: UM.Theme.getSize("thick_margin").width / 1.5
} }
UM.TabRow UM.TabRow
{ {
id: tabBar id: tabBar
anchors.top: popupItemHeader.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.topMargin: UM.Theme.getSize("default_margin").height
onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex) onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex)
z: 1 z: 1
@ -309,7 +310,7 @@ Cura.ExpandableComponent
{ {
id: footerControll id: footerControll
anchors.top: popupItemContent.bottom 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 width: parent.width
height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4 height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4
Rectangle Rectangle
@ -337,10 +338,10 @@ Cura.ExpandableComponent
anchors anchors
{ {
top: parent.top top: parent.top
topMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 topMargin: UM.Theme.getSize("narrow_margin").height * 2
bottomMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 bottomMargin: UM.Theme.getSize("narrow_margin").height * 2
right: parent.right right: parent.right
rightMargin: UM.Theme.getSize("print_setup_selector_margin").height rightMargin: UM.Theme.getSize("narrow_margin").height
} }
onClicked: currentModeIndex = 1 onClicked: currentModeIndex = 1
@ -361,19 +362,15 @@ Cura.ExpandableComponent
anchors anchors
{ {
top: parent.top top: parent.top
topMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 topMargin: UM.Theme.getSize("narrow_margin").height * 2
bottomMargin: UM.Theme.getSize("print_setup_selector_margin").height * 2 bottomMargin: UM.Theme.getSize("narrow_margin").height * 2
left: parent.left left: parent.left
leftMargin: UM.Theme.getSize("print_setup_selector_margin").height leftMargin: UM.Theme.getSize("narrow_margin").height
} }
// onClicked: currentModeIndex = 0
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: currentModeIndex = 0
currentModeIndex = 0
}
} }
} }
} }

View File

@ -535,9 +535,7 @@
"monitor_shadow_radius": [0.4, 0.4], "monitor_shadow_radius": [0.4, 0.4],
"monitor_shadow_offset": [0.15, 0.15], "monitor_shadow_offset": [0.15, 0.15],
"print_setup_selector_margin": [0.5, 0.5],
"print_setup_action_button": [13, 5], "print_setup_action_button": [13, 5],
"print_setup_tap_bar": [4, 4],
"print_setup_content_top_margin": [3, 3] "print_setup_content_top_margin": [3, 3]
} }
} }