Commit 375b0861 authored by Kai Koehne's avatar Kai Koehne

QmlDesigner: Fix artifact when moving items around

Don't use the dynamic property "HasFormEditorItem" any more when
checking whether childs have to be drawn directly by it's parent.

The problem was actually introduced with the new dynamic metatype
object (NodeInstanceMetaObject). At the time the dynamic property
"HasFormEditorItem" is set in
GraphicsObjectNodeInstance::createGraphicsObject(), the new metatype
object hasn't been created & attached to the object yet. The dynamic
property was effectively lost when the metatype object changed, leading
to multiple drawings of the child item.

This fix replaces the "HasFormEditorItem" property by directly asking
the NodeInstanceView whether an item draws itself or not.

Reviewed-by: Thomas Hartmann
parent 96e2fef6
......@@ -193,7 +193,7 @@ void GraphicsObjectNodeInstance::paint(QPainter *painter) const
foreach(QGraphicsItem *graphicsItem, graphicsObject()->childItems()) {
QGraphicsObject *graphicsObject = qgraphicsitem_cast<QGraphicsObject*>(graphicsItem);
if (graphicsObject && !graphicsObject->property("HasFormEditorItem").toBool())
if (graphicsObject && !nodeInstanceView()->hasInstanceForObject(graphicsObject))
paintRecursively(graphicsItem, painter);
}
}
......@@ -213,8 +213,6 @@ QPair<QGraphicsObject*, bool> GraphicsObjectNodeInstance::createGraphicsObject(c
bool hasContent = !graphicsObject->flags().testFlag(QGraphicsItem::ItemHasNoContents) || metaInfo.isComponent();
graphicsObject->setFlag(QGraphicsItem::ItemHasNoContents, false);
graphicsObject->setProperty("HasFormEditorItem", true);
return qMakePair(graphicsObject, hasContent);
}
......
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