Commit 862bc044 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner.NodeInstances: Workaround qml design bug

Task-number: QTCREATORBUG-5005

Change-Id: Ia0f1f30a04818bc6ee55a0822eaf0d2b0183e50d
Reviewed-on: http://codereview.qt.nokia.com/1252Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarMarco Bubke <marco.bubke@nokia.com>
parent 600127e8
......@@ -45,6 +45,7 @@ GraphicsObjectNodeInstance::GraphicsObjectNodeInstance(QGraphicsObject *graphics
: ObjectNodeInstance(graphicsObject),
m_isMovable(true)
{
QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification = 1;
}
QGraphicsObject *GraphicsObjectNodeInstance::graphicsObject() const
......
......@@ -207,13 +207,24 @@ void QmlGraphicsItemNodeInstance::refresh()
repositioning(qmlGraphicsItem());
}
void QmlGraphicsItemNodeInstance::doComponentComplete()
void QmlGraphicsItemNodeInstance::recursiveDoComponentComplete(QGraphicsItem *item)
{
if (qmlGraphicsItem()) {
if (static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(qmlGraphicsItem()))->componentComplete)
QGraphicsObject *graphicsObject = item->toGraphicsObject();
QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(graphicsObject);
if (declarativeItem && !nodeInstanceServer()->hasInstanceForObject(declarativeItem)) {
if (QDeclarativeItemPrivate::get(qmlGraphicsItem())->componentComplete)
return;
static_cast<QDeclarativeParserStatus*>(qmlGraphicsItem())->componentComplete();
QGraphicsItemPrivate::get(qmlGraphicsItem())->sendParentChangeNotification = 1;
foreach (QGraphicsItem *childItem, item->childItems())
recursiveDoComponentComplete(childItem);
}
}
void QmlGraphicsItemNodeInstance::doComponentComplete()
{
if (qmlGraphicsItem()) {
recursiveDoComponentComplete(qmlGraphicsItem());
}
graphicsObject()->update();
......@@ -301,7 +312,9 @@ void QmlGraphicsItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &ol
setMovable(true);
}
QDeclarativeItemPrivate::get(qmlGraphicsItem())->componentComplete = 1;
GraphicsObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty);
QDeclarativeItemPrivate::get(qmlGraphicsItem())->componentComplete = 0;
if (newParentInstance && newParentInstance->isPositioner()) {
setInPositioner(true);
......
......@@ -85,6 +85,7 @@ protected:
void resetHorizontal();
void resetVertical();
void refresh();
void recursiveDoComponentComplete(QGraphicsItem *item);
private: //variables
bool m_hasHeight;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment