mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-17 00:35:56 +08:00
Simplify the OpenFilesMenu
CURA-8683
This commit is contained in:
parent
d7d6918ab7
commit
3e4c171603
@ -20,10 +20,7 @@ Cura.Menu
|
|||||||
model: CuraApplication.getFileProviderModel()
|
model: CuraApplication.getFileProviderModel()
|
||||||
Cura.MenuItem
|
Cura.MenuItem
|
||||||
{
|
{
|
||||||
text:
|
text: model.displayText
|
||||||
{
|
|
||||||
return model.displayText;
|
|
||||||
}
|
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
if (model.index == 0) // The 0th element is the "From Disk" option, which should activate the open local file dialog
|
if (model.index == 0) // The 0th element is the "From Disk" option, which should activate the open local file dialog
|
||||||
@ -35,12 +32,10 @@ Cura.Menu
|
|||||||
CuraApplication.getFileProviderModel().trigger(model.name);
|
CuraApplication.getFileProviderModel().trigger(model.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Unassign the shortcuts when the submenu is invisible (i.e. when there is only one file provider) to avoid ambiguous shortcuts.
|
shortcut: model.shortcut
|
||||||
// When there is a single file provider, the openAction is assigned with the Ctrl+O shortcut instead.
|
|
||||||
shortcut: openFilesMenu.visible ? model.shortcut : ""
|
|
||||||
visible: openFilesMenu.visible
|
|
||||||
}
|
}
|
||||||
onObjectAdded: openFilesMenu.insertItem(index, object)
|
onObjectAdded: openFilesMenu.insertItem(index, object)
|
||||||
|
|
||||||
onObjectRemoved: openFilesMenu.removeItem(object)
|
onObjectRemoved: openFilesMenu.removeItem(object)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user