Fix style for the open file button in the prepare menu.

Contributes to CURA-5942.
This commit is contained in:
Diego Prado Gesto 2018-11-26 15:08:33 +01:00
parent 0a1c0e18d1
commit 84f263f111

View File

@ -3,7 +3,7 @@
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Controls 1.4 import QtQuick.Controls 2.3
import UM 1.3 as UM import UM 1.3 as UM
import Cura 1.1 as Cura import Cura 1.1 as Cura
@ -27,14 +27,14 @@ Item
Item Item
{ {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: openFileButtonBackground.width + itemRow.width + UM.Theme.getSize("default_margin").width width: openFileButton.width + itemRow.width + UM.Theme.getSize("default_margin").width
height: parent.height height: parent.height
RowLayout RowLayout
{ {
id: itemRow id: itemRow
anchors.left: openFileButtonBackground.right anchors.left: openFileButton.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
width: Math.round(0.9 * prepareMenu.width) width: Math.round(0.9 * prepareMenu.width)
@ -44,7 +44,7 @@ Item
Cura.MachineSelector Cura.MachineSelector
{ {
id: machineSelection id: machineSelection
z: openFileButtonBackground.z - 1 //Ensure that the tooltip of the open file button stays above the item row. z: openFileButton.z - 1 //Ensure that the tooltip of the open file button stays above the item row.
headerCornerSide: Cura.RoundedRectangle.Direction.Left headerCornerSide: Cura.RoundedRectangle.Direction.Left
Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width
Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width
@ -86,24 +86,31 @@ Item
} }
} }
Rectangle Button
{
id: openFileButton
height: UM.Theme.getSize("stage_menu").height
width: UM.Theme.getSize("stage_menu").height
onClicked: Cura.Actions.open.trigger()
contentItem: UM.RecolorImage
{
id: buttonIcon
source: UM.Theme.getIcon("load")
width: UM.Theme.getSize("button_icon").width
height: UM.Theme.getSize("button_icon").height
color: UM.Theme.getColor("toolbar_button_text")
sourceSize: UM.Theme.getSize("button_icon")
}
background: Rectangle
{ {
id: openFileButtonBackground
height: UM.Theme.getSize("stage_menu").height height: UM.Theme.getSize("stage_menu").height
width: UM.Theme.getSize("stage_menu").height width: UM.Theme.getSize("stage_menu").height
radius: UM.Theme.getSize("default_radius").width radius: UM.Theme.getSize("default_radius").width
color: UM.Theme.getColor("toolbar_background") color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
Button
{
id: openFileButton
text: catalog.i18nc("@action:button", "Open File")
iconSource: UM.Theme.getIcon("load")
style: UM.Theme.styles.toolbar_button
tooltip: ""
action: Cura.Actions.open
anchors.centerIn: parent
} }
} }
} }