Add list of open file providers to submenu

The layout isn't quite there yet, but it mostly works and I want to have a save point to return to if I tinker too much.

Contributes to issue CURA-8008.
This commit is contained in:
Ghostkeeper 2021-07-09 17:02:38 +02:00
parent 0db1f1034b
commit f8aa6a3398
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -131,6 +131,49 @@ Item
width: contentWidth width: contentWidth
height: contentHeight height: contentHeight
} }
Repeater
{
model: prepareMenu.fileProviderModel
delegate: Button
{
leftPadding: UM.Theme.getSize("thick_margin").width
rightPadding: UM.Theme.getSize("thick_margin").width
width: contentItem.width + leftPadding + rightPadding
height: UM.Theme.getSize("action_button").height
hoverEnabled: true
contentItem: Label
{
text: model.displayText
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
width: contentWidth
height: contentHeight
}
onClicked:
{
if(model.index == 0) //The 0th element is the "From Disk" option, which should activate the open local file dialog.
{
Cura.Actions.open.trigger();
}
else
{
prepareMenu.fileProviderModel.trigger(model.name);
}
}
background: Rectangle
{
color: parent.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent"
radius: UM.Theme.getSize("action_button_radius").width
}
}
}
} }
} }
} }