Update styling and functionality of sidebar in cura

This commit is contained in:
Arjen Hiemstra 2015-04-01 12:09:31 +02:00
parent bd1e12b492
commit a173022ec6
3 changed files with 115 additions and 245 deletions

View file

@ -5,73 +5,11 @@ import QtQuick.Layouts 1.1
import UM 1.0 as UM
UM.AngledCornerRectangle {
Button {
id: base;
Layout.preferredHeight: UM.Theme.sizes.section.height;
Layout.preferredWidth: UM.Theme.sizes.section.width;
property bool clickable: false;
signal clicked();
color: clickable ? UM.Theme.colors.button : UM.Theme.colors.primary;
cornerSize: UM.Theme.sizes.default_margin.width;
property alias icon: iconImage.source;
property alias text: label.text;
Image {
id: iconImage;
anchors {
left: parent.left;
leftMargin: UM.Theme.sizes.default_margin.width;
verticalCenter: parent.verticalCenter;
}
width: UM.Theme.sizes.section_icon.width;
height: UM.Theme.sizes.section_icon.width;
sourceSize.width: width;
sourceSize.height: height;
}
Label {
id: label
anchors {
left: iconImage.right;
leftMargin: UM.Theme.sizes.default_margin.width;
right: parent.right;
rightMargin: UM.Theme.sizes.default_margin.width;
verticalCenter: parent.verticalCenter;
}
font: UM.Theme.fonts.large;
color: UM.Theme.colors.primary_text;
}
MouseArea {
id: mouse;
anchors.fill: parent;
enabled: base.clickable;
hoverEnabled: true;
onClicked: {console.log('click'); base.clicked(); }
}
states: [
State {
name: "hover";
when: mouse.containsMouse;
PropertyChanges { target: base; color: UM.Theme.colors.button_hover; }
},
State {
name: "down";
when: mouse.pressed;
PropertyChanges { target: base; color: UM.Theme.colors.button_down; }
}
]
style: UM.Theme.styles.sidebar_category;
}