Setting parent on toolbox causes problems. Instead delete via connection

Reviewed-by: Eike Hein
This commit is contained in:
David Edmundson 2014-07-17 20:29:36 +02:00
parent 5e9fc425c6
commit c38e6a204e

View File

@ -123,7 +123,7 @@ void ContainmentInterface::init()
QObject *toolBoxObject = qmlObject()->createObjectFromSource(QUrl::fromLocalFile(pkg.filePath("mainscript")), 0, toolboxProperties); QObject *toolBoxObject = qmlObject()->createObjectFromSource(QUrl::fromLocalFile(pkg.filePath("mainscript")), 0, toolboxProperties);
if (toolBoxObject && containmentGraphicObject) { if (toolBoxObject && containmentGraphicObject) {
containmentGraphicObject->setProperty("toolBox", QVariant::fromValue(toolBoxObject)); containmentGraphicObject->setProperty("toolBox", QVariant::fromValue(toolBoxObject));
toolBoxObject->setParent(containmentGraphicObject); connect(containmentGraphicObject, &QObject::destroyed, toolBoxObject, &QObject::deleteLater);
} }
} else { } else {
qWarning() << "Could not load toolbox package." << pkg.path(); qWarning() << "Could not load toolbox package." << pkg.path();