Commit 12ef2e84 authored by Marco Bubke's avatar Marco Bubke Committed by Kai Koehne

Fix ordering bug in the form editor

Task-Id: BAUHAUS-475
parent 044b0b8e
......@@ -154,8 +154,7 @@ void FormEditorScene::synchronizeTransformation(const QmlItemNode &qmlItemNode)
void FormEditorScene::synchronizeParent(const QmlItemNode &qmlItemNode)
{
QmlItemNode parentNode = qmlItemNode.instanceParent().toQmlItemNode();
if (parentNode.isValid())
reparentItem(qmlItemNode, parentNode);
reparentItem(qmlItemNode, parentNode);
}
void FormEditorScene::synchronizeOtherProperty(const QmlItemNode &qmlItemNode, const QString &propertyName)
......@@ -330,9 +329,11 @@ void FormEditorScene::hoverLeaveEvent(QGraphicsSceneHoverEvent * /*event*/)
void FormEditorScene::reparentItem(const QmlItemNode &node, const QmlItemNode &newParent)
{
Q_ASSERT(hasItemForQmlItemNode(node));
Q_ASSERT(hasItemForQmlItemNode(newParent));
FormEditorItem *item = itemForQmlItemNode(node);
FormEditorItem *parentItem = itemForQmlItemNode(newParent);
FormEditorItem *parentItem = 0;
if (newParent.isValid() && hasItemForQmlItemNode(newParent))
FormEditorItem *parentItem = itemForQmlItemNode(newParent);
if (item->parentItem() != parentItem) {
item->setParentItem(parentItem);
item->update();
......
......@@ -512,12 +512,7 @@ void FormEditorView::transformChanged(const QmlObjectNode &qmlObjectNode, const
void FormEditorView::parentChanged(const QmlObjectNode &qmlObjectNode)
{
QmlItemNode itemNode = qmlObjectNode.toQmlItemNode();
QmlItemNode parentNode = qmlObjectNode.instanceParent().toQmlItemNode();
if (itemNode.isValid()
&& scene()->hasItemForQmlItemNode(itemNode)
&& parentNode.isValid()
&& scene()->hasItemForQmlItemNode(parentNode)
&& scene()->itemForQmlItemNode(itemNode)->parentItem() != scene()->itemForQmlItemNode(parentNode)) {
if (itemNode.isValid() && scene()->hasItemForQmlItemNode(itemNode)) {
scene()->synchronizeParent(itemNode);
m_currentTool->formEditorItemsChanged(QList<FormEditorItem*>() << m_scene->itemForQmlItemNode(itemNode));
}
......
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