diff options
author | Ghostkeeper <rubend@tutanota.com> | 2021-07-09 18:02:38 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2021-07-09 18:02:38 +0300 |
commit | f8aa6a3398d2dda18b7c78b6121281f137cd5c6f (patch) | |
tree | 3bc5369fdd4c4410f3db7d7848628798bef53f3a /plugins/PrepareStage | |
parent | 0db1f1034b164b783ff395afc87e7cdc1e13a183 (diff) |
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.
Diffstat (limited to 'plugins/PrepareStage')
-rw-r--r-- | plugins/PrepareStage/PrepareMenu.qml | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 1916a5813d..31da2f356b 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -131,6 +131,49 @@ Item width: contentWidth 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 + } + } + } } } } |