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 ...@@ -45,6 +45,7 @@ GraphicsObjectNodeInstance::GraphicsObjectNodeInstance(QGraphicsObject *graphics
: ObjectNodeInstance(graphicsObject), : ObjectNodeInstance(graphicsObject),
m_isMovable(true) m_isMovable(true)
{ {
QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification = 1;
} }
QGraphicsObject *GraphicsObjectNodeInstance::graphicsObject() const QGraphicsObject *GraphicsObjectNodeInstance::graphicsObject() const
......
...@@ -207,13 +207,24 @@ void QmlGraphicsItemNodeInstance::refresh() ...@@ -207,13 +207,24 @@ void QmlGraphicsItemNodeInstance::refresh()
repositioning(qmlGraphicsItem()); repositioning(qmlGraphicsItem());
} }
void QmlGraphicsItemNodeInstance::doComponentComplete() void QmlGraphicsItemNodeInstance::recursiveDoComponentComplete(QGraphicsItem *item)
{ {
if (qmlGraphicsItem()) { QGraphicsObject *graphicsObject = item->toGraphicsObject();
if (static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(qmlGraphicsItem()))->componentComplete) QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(graphicsObject);
if (declarativeItem && !nodeInstanceServer()->hasInstanceForObject(declarativeItem)) {
if (QDeclarativeItemPrivate::get(qmlGraphicsItem())->componentComplete)
return; return;
static_cast<QDeclarativeParserStatus*>(qmlGraphicsItem())->componentComplete(); 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(); graphicsObject()->update();
...@@ -301,7 +312,9 @@ void QmlGraphicsItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &ol ...@@ -301,7 +312,9 @@ void QmlGraphicsItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &ol
setMovable(true); setMovable(true);
} }
QDeclarativeItemPrivate::get(qmlGraphicsItem())->componentComplete = 1;
GraphicsObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty); GraphicsObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty);
QDeclarativeItemPrivate::get(qmlGraphicsItem())->componentComplete = 0;
if (newParentInstance && newParentInstance->isPositioner()) { if (newParentInstance && newParentInstance->isPositioner()) {
setInPositioner(true); setInPositioner(true);
......
...@@ -85,6 +85,7 @@ protected: ...@@ -85,6 +85,7 @@ protected:
void resetHorizontal(); void resetHorizontal();
void resetVertical(); void resetVertical();
void refresh(); void refresh();
void recursiveDoComponentComplete(QGraphicsItem *item);
private: //variables private: //variables
bool m_hasHeight; 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