Commit a09902ec authored by Marco Bubke's avatar Marco Bubke Committed by Thomas Hartmann

QmlDesigner.FormEditor: Items with no parent should be invisible except

the root item

This is preventing visual artefacts.
parent d51b579d
......@@ -72,7 +72,10 @@ void FormEditorItem::setup()
{
if (qmlItemNode().hasInstanceParent()) {
setParentItem(scene()->itemForQmlItemNode(qmlItemNode().instanceParent().toQmlItemNode()));
setVisible(true);
setOpacity(qmlItemNode().instanceValue("opacity").toDouble());
} else if (!qmlItemNode().isRootNode()){
setVisible(false);
}
setFlag(QGraphicsItem::ItemClipsChildrenToShape, qmlItemNode().instanceValue("clip").toBool());
......
......@@ -204,6 +204,8 @@ FormEditorItem *FormEditorScene::addFormEditorItem(const QmlItemNode &qmlItemNod
manipulatorLayerItem()->update();
}
return formEditorItem;
}
......@@ -342,6 +344,12 @@ void FormEditorScene::reparentItem(const QmlItemNode &node, const QmlItemNode &n
if (item->parentItem() != parentItem) {
item->setParentItem(parentItem);
if (parentItem) {
item->setVisible(true);
} else {
item->setVisible(false);
}
item->update();
}
}
......@@ -370,8 +378,10 @@ void FormEditorScene::clearFormEditorItems()
QList<QGraphicsItem*> itemList(items());
foreach (QGraphicsItem *item, itemList) {
if (qgraphicsitem_cast<FormEditorItem* >(item))
if (qgraphicsitem_cast<FormEditorItem* >(item)) {
item->setParentItem(0);
item->setVisible(false);
}
}
foreach (QGraphicsItem *item, itemList) {
......
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