Don't crash when the containment or toolbox doesn't load

Check if the containment could be loaded (this includes the toolbox), if
not, don't poke into its rootObject.
This commit is contained in:
Sebastian Kügler 2013-04-10 02:18:41 +02:00
parent 788870fffc
commit fe8be600c6

View File

@ -168,13 +168,14 @@ void AppletInterface::init()
}
//set parent, both as object hyerarchy and visually
m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this));
//set anchors
QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_qmlObject->rootObject(), "parent");
QQmlProperty prop(m_qmlObject->rootObject(), "anchors.fill");
prop.write(expr.evaluate());
if (m_qmlObject->rootObject()) {
m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this));
//set anchors
QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_qmlObject->rootObject(), "parent");
QQmlProperty prop(m_qmlObject->rootObject(), "anchors.fill");
prop.write(expr.evaluate());
}
geometryChanged(QRectF(), QRectF(x(), y(), width(), height()));
emit busyChanged();
}