mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-29 22:01:14 -07:00
Replace material sub-menus with custom Popup
The sub-menus were giving segfaults for some reason. We couldn't figure out how to circumvent that. So now we're at a last resort: Implement the whole thing ourselves, but with Popup instead of Menu. Contributes to issue CURA-8640.
This commit is contained in:
parent
4abdd675f6
commit
11b557b3d9
3 changed files with 108 additions and 38 deletions
|
|
@ -98,45 +98,12 @@ Cura.Menu
|
|||
Instantiator
|
||||
{
|
||||
model: brandModel
|
||||
Cura.Menu
|
||||
delegate: Cura.MaterialBrandMenu
|
||||
{
|
||||
id: brandMenu
|
||||
title: brandName
|
||||
property string brandName: model.name
|
||||
property var brandMaterials: model.material_types
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: brandMaterials
|
||||
delegate: Cura.Menu
|
||||
{
|
||||
id: brandMaterialsMenu
|
||||
title: materialName
|
||||
property string materialName: model.name
|
||||
property var brandMaterialColors: model.colors
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: brandMaterialColors
|
||||
delegate: Cura.MenuItem
|
||||
{
|
||||
text: model.name
|
||||
checkable: true
|
||||
enabled: isActiveExtruderEnabled
|
||||
checked: model.id === materialMenu.activeMaterialId
|
||||
|
||||
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
||||
}
|
||||
onObjectAdded: function(index, object) { brandMaterialsMenu.insertItem(index, object)}
|
||||
onObjectRemoved: function(object) {brandMaterialsMenu.removeItem(object)}
|
||||
}
|
||||
}
|
||||
onObjectAdded: function(index, object) { brandMenu.insertMenu(index, object)}
|
||||
onObjectRemoved: function(object) {brandMenu.removeMenu(object)}
|
||||
}
|
||||
text: model.name
|
||||
}
|
||||
onObjectAdded: function(index, object) {materialMenu.insertMenu(index + 4, object)}
|
||||
onObjectRemoved: function(object) { materialMenu.removeMenu(object)}
|
||||
onObjectAdded: function(index, object) { materialMenu.insertItem(index + 4, object)}
|
||||
onObjectRemoved: function(object) { materialMenu.removeItem(index) }
|
||||
}
|
||||
|
||||
Cura.MenuSeparator {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue