mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
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.
This commit is contained in:
parent
c100ba88d0
commit
5bc3848301
1 changed files with 7 additions and 2 deletions
|
@ -13,6 +13,8 @@ Item
|
||||||
{
|
{
|
||||||
id: prepareMenu
|
id: prepareMenu
|
||||||
|
|
||||||
|
property var fileProviderModel: CuraApplication.getFileProviderModel()
|
||||||
|
|
||||||
UM.I18nCatalog
|
UM.I18nCatalog
|
||||||
{
|
{
|
||||||
id: catalog
|
id: catalog
|
||||||
|
@ -78,6 +80,8 @@ Item
|
||||||
Cura.ExpandablePopup
|
Cura.ExpandablePopup
|
||||||
{
|
{
|
||||||
id: openFileMenu
|
id: openFileMenu
|
||||||
|
visible: prepareMenu.fileProviderModel.count > 1
|
||||||
|
|
||||||
contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft
|
contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft
|
||||||
headerCornerSide: Cura.RoundedRectangle.Direction.All
|
headerCornerSide: Cura.RoundedRectangle.Direction.All
|
||||||
headerPadding: Math.round((parent.height - UM.Theme.getSize("button_icon").height) / 2)
|
headerPadding: Math.round((parent.height - UM.Theme.getSize("button_icon").height) / 2)
|
||||||
|
@ -107,11 +111,12 @@ Item
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
id: openFileButton
|
id: openFileButton
|
||||||
|
visible: prepareMenu.fileProviderModel.count <= 1
|
||||||
|
|
||||||
height: parent.height
|
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()
|
onClicked: Cura.Actions.open.trigger()
|
||||||
enabled: visible
|
enabled: visible && prepareMenu.fileProviderModel.count > 0
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
contentItem: Item
|
contentItem: Item
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue