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 //set parent, both as object hyerarchy and visually
if (m_qmlObject->rootObject()) {
m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this)); m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this));
//set anchors //set anchors
QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_qmlObject->rootObject(), "parent"); QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_qmlObject->rootObject(), "parent");
QQmlProperty prop(m_qmlObject->rootObject(), "anchors.fill"); QQmlProperty prop(m_qmlObject->rootObject(), "anchors.fill");
prop.write(expr.evaluate()); prop.write(expr.evaluate());
}
geometryChanged(QRectF(), QRectF(x(), y(), width(), height())); geometryChanged(QRectF(), QRectF(x(), y(), width(), height()));
emit busyChanged(); emit busyChanged();
} }