diff options
author | Ghostkeeper <rubend@tutanota.com> | 2021-07-09 16:33:57 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2021-07-09 16:33:57 +0300 |
commit | 5bc384830114fb4144709784441f0c5900900bb9 (patch) | |
tree | 026b66aa806510c93abf5eb3d29e36503ef650a3 /plugins/PrepareStage | |
parent | c100ba88d0589f11d9979c08b94c48f35d605724 (diff) |
Show either openFileButton or openFileMenu, depending on provider count
If there's just 1 provider, show the button. If there are multiple, show the menu. If there are 0, also show the button but disable the button.
The behaviour is not yet implemented though. It doesn't actually look at which providers are available and what they do.
Contributes to issue CURA-8008.
Diffstat (limited to 'plugins/PrepareStage')
-rw-r--r-- | plugins/PrepareStage/PrepareMenu.qml | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 576cd3cd95..219979407b 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -13,6 +13,8 @@ Item { id: prepareMenu + property var fileProviderModel: CuraApplication.getFileProviderModel() + UM.I18nCatalog { id: catalog @@ -78,6 +80,8 @@ Item Cura.ExpandablePopup { id: openFileMenu + visible: prepareMenu.fileProviderModel.count > 1 + contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft headerCornerSide: Cura.RoundedRectangle.Direction.All headerPadding: Math.round((parent.height - UM.Theme.getSize("button_icon").height) / 2) @@ -107,11 +111,12 @@ Item Button { id: openFileButton + visible: prepareMenu.fileProviderModel.count <= 1 height: parent.height - width: height //Square button. + width: visible ? height : 0 //Square button (and don't take up space if invisible). onClicked: Cura.Actions.open.trigger() - enabled: visible + enabled: visible && prepareMenu.fileProviderModel.count > 0 hoverEnabled: true contentItem: Item |