Fix QObject segfaults in QML

CURA-6599
This commit is contained in:
Lipu Fei 2019-09-25 14:38:27 +02:00
parent d1330e5ffa
commit 9ced5e9205
4 changed files with 37 additions and 6 deletions

View file

@ -15,6 +15,14 @@ class QualityChangesGroup(QObject):
def __init__(self, name: str, quality_type: str, intent_category: str, parent: Optional["QObject"] = None) -> None:
super().__init__(parent)
# CURA-6599
# For some reason, QML will get null or fail to convert type for MachineManager.activeQualityChangesGroup() to
# a QObject. Setting the object ownership to QQmlEngine.CppOwnership doesn't work, but setting the object
# parent to application seems to work.
from cura.CuraApplication import CuraApplication
self.setParent(CuraApplication.getInstance())
self.name = name
self.quality_type = quality_type
self.intent_category = intent_category