15.10 Restyling Toolbar buttons

Contributes to: issue CURA-60
This commit is contained in:
Tamara Hogenhout 2015-08-17 17:30:53 +02:00
parent 7adc9732e8
commit efbae53e6e

View file

@ -12,33 +12,14 @@ Item {
id: base; id: base;
width: buttons.width; width: buttons.width;
height: buttons.height + panel.height; height: buttons.height
Rectangle {
id: activeItemBackground;
anchors.bottom: parent.bottom;
anchors.bottomMargin: UM.Theme.sizes.default_margin.height;
width: UM.Theme.sizes.button.width;
height: UM.Theme.sizes.button.height * 2;
opacity: panelBackground.opacity;
color: UM.Theme.colors.tool_panel_background
function setActive(new_x) {
x = new_x;
}
}
RowLayout { RowLayout {
id: buttons; id: buttons;
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
anchors.left: parent.left; anchors.left: parent.left;
spacing: 1
spacing: UM.Theme.sizes.default_margin.width * 2;
Repeater { Repeater {
id: repeat id: repeat
@ -51,7 +32,6 @@ Item {
checkable: true; checkable: true;
checked: model.active; checked: model.active;
onCheckedChanged: if (checked) activeItemBackground.setActive(x);
style: UM.Theme.styles.tool_button; style: UM.Theme.styles.tool_button;
@ -65,21 +45,28 @@ Item {
} }
} }
UM.AngledCornerRectangle { Rectangle {
width: base.width - 10
height: base.height
z: parent.z - 1
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
color: UM.Theme.colors.button_lining
}
Rectangle {
id: panelBackground; id: panelBackground;
anchors.left: parent.left; anchors.left: parent.left;
anchors.bottom: buttons.top; anchors.top: buttons.bottom;
anchors.bottomMargin: UM.Theme.sizes.default_margin.height;
width: panel.item ? Math.max(panel.width + 2 * UM.Theme.sizes.default_margin.width, activeItemBackground.x + activeItemBackground.width) : 0; width: panel.item ? Math.max(panel.width + 2 * UM.Theme.sizes.default_margin.width) : 0;
height: panel.item ? panel.height + 2 * UM.Theme.sizes.default_margin.height : 0; height: panel.item ? panel.height + 2 * UM.Theme.sizes.default_margin.height : 0;
opacity: panel.item ? 1 : 0 opacity: panel.item ? 1 : 0
Behavior on opacity { NumberAnimation { duration: 100 } } Behavior on opacity { NumberAnimation { duration: 100 } }
color: UM.Theme.colors.tool_panel_background; color: UM.Theme.colors.tool_panel_background;
cornerSize: width > 0 ? UM.Theme.sizes.default_margin.width : 0;
Loader { Loader {
id: panel id: panel