Add a object list panel instead of the open file button

This commit is contained in:
Diego Prado Gesto 2019-02-15 17:50:52 +01:00
parent 75b185d462
commit 86c7d3e5ab
7 changed files with 240 additions and 59 deletions

View file

@ -24,14 +24,14 @@ Item
Item
{
anchors.horizontalCenter: parent.horizontalCenter
width: openFileButton.width + itemRow.width + UM.Theme.getSize("default_margin").width
width: objectSelector.width + itemRow.width + UM.Theme.getSize("default_margin").width
height: parent.height
RowLayout
{
id: itemRow
anchors.left: openFileButton.right
anchors.left: objectSelector.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
width: Math.round(0.9 * prepareMenu.width)
@ -82,53 +82,60 @@ Item
}
}
Button
Cura.ObjectSelector
{
id: openFileButton
id: objectSelector
height: UM.Theme.getSize("stage_menu").height
width: UM.Theme.getSize("stage_menu").height
onClicked: Cura.Actions.open.trigger()
hoverEnabled: true
contentItem: Item
{
anchors.fill: parent
UM.RecolorImage
{
id: buttonIcon
anchors.centerIn: parent
source: UM.Theme.getIcon("load")
width: UM.Theme.getSize("button_icon").width
height: UM.Theme.getSize("button_icon").height
color: UM.Theme.getColor("icon")
sourceSize.height: height
}
}
background: Rectangle
{
id: background
height: UM.Theme.getSize("stage_menu").height
width: UM.Theme.getSize("stage_menu").height
radius: UM.Theme.getSize("default_radius").width
color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
}
DropShadow
{
id: shadow
// Don't blur the shadow
radius: 0
anchors.fill: background
source: background
verticalOffset: 2
visible: true
color: UM.Theme.getColor("action_button_shadow")
// Should always be drawn behind the background.
z: background.z - 1
}
}
// Button
// {
// id: openFileButton
// height: UM.Theme.getSize("stage_menu").height
// width: UM.Theme.getSize("stage_menu").height
// onClicked: Cura.Actions.open.trigger()
// hoverEnabled: true
//
// contentItem: Item
// {
// anchors.fill: parent
// UM.RecolorImage
// {
// id: buttonIcon
// anchors.centerIn: parent
// source: UM.Theme.getIcon("load")
// width: UM.Theme.getSize("button_icon").width
// height: UM.Theme.getSize("button_icon").height
// color: UM.Theme.getColor("icon")
//
// sourceSize.height: height
// }
// }
//
// background: Rectangle
// {
// id: background
// height: UM.Theme.getSize("stage_menu").height
// width: UM.Theme.getSize("stage_menu").height
//
// radius: UM.Theme.getSize("default_radius").width
// color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
// }
//
// DropShadow
// {
// id: shadow
// // Don't blur the shadow
// radius: 0
// anchors.fill: background
// source: background
// verticalOffset: 2
// visible: true
// color: UM.Theme.getColor("action_button_shadow")
// // Should always be drawn behind the background.
// z: background.z - 1
// }
// }
}
}