implements the new load file button styling

(so that the mouse-over label can be translated..). The final icon will be added later.

Contributes to: issue CURA-129
This commit is contained in:
Tamara Hogenhout 2015-09-10 14:57:55 +02:00
parent 096065a441
commit 7ef41d1556
2 changed files with 29 additions and 13 deletions

View File

@ -301,7 +301,7 @@ UM.MainWindow
//style: UM.Theme.styles.open_file_button //style: UM.Theme.styles.open_file_button
text: catalog.i18nc("@action:button","Open File"); text: catalog.i18nc("@action:button","Open File");
iconSource: UM.Theme.icons.open iconSource: UM.Theme.icons.open
style: UM.Theme.styles.tool_button; style: UM.Theme.styles.open_file_button
tooltip: ''; tooltip: '';
anchors anchors
{ {

View File

@ -56,23 +56,39 @@ QtObject {
property Component open_file_button: Component { property Component open_file_button: Component {
ButtonStyle { ButtonStyle {
background: Item{ background: Item{
implicitWidth: UM.Theme.sizes.loadfile_button.width implicitWidth: UM.Theme.sizes.button.width;
implicitHeight: UM.Theme.sizes.loadfile_button.height implicitHeight: UM.Theme.sizes.button.width;
Rectangle { Rectangle {
width: parent.width anchors.left: parent.right
height: parent.height anchors.verticalCenter: parent.verticalCenter
color: "white"
width: control.hovered ? openFileLabel.width : 0;
height: openFileLabel.height
Behavior on width { NumberAnimation { duration: 100; } }
opacity: control.hovered ? 1.0 : 0.0;
Behavior on opacity { NumberAnimation { duration: 100; } }
Label {
id: openFileLabel
anchors.bottom: parent.bottom
text: control.text
font: UM.Theme.fonts.button_tooltip;
color: UM.Theme.colors.button_tooltip_text;
}
}
Rectangle {
anchors.fill: parent;
color: control.hovered ? UM.Theme.colors.load_save_button_hover : UM.Theme.colors.load_save_button color: control.hovered ? UM.Theme.colors.load_save_button_hover : UM.Theme.colors.load_save_button
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
} }
Label {
anchors.centerIn: parent
text: control.text
color: UM.Theme.colors.load_save_button_text
font: UM.Theme.fonts.default
}
} }
label: Label{ label: Item {
visible: false Image {
anchors.centerIn: parent;
source: control.iconSource;
width: UM.Theme.sizes.button_icon.width;
height: UM.Theme.sizes.button_icon.height;
sourceSize: UM.Theme.sizes.button_icon;
}
} }
} }
} }