Commit 0b2cab59 authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Update the parent too for bypass manipulation



Task-number:	QTCREATORBUG-12570
Change-Id: I038bfb233c0a8a734ae82b1b31fca8f5aa8c9763
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent c40dc767
......@@ -99,9 +99,6 @@ void MoveManipulator::synchronizeParent(const QList<FormEditorItem*> &itemList,
}
}
}
if (!parentNode.metaInfo().isLayoutable())
update(m_lastPosition, Snapper::NoSnapping, UseBaseState);
}
void MoveManipulator::synchronizeInstanceParent(const QList<FormEditorItem*> &itemList)
......
......@@ -136,6 +136,7 @@ public:
NodeInstance activeStateInstance() const;
void updateChildren(const NodeAbstractProperty &newPropertyParent);
void updatePosition(const QList<VariantProperty>& propertyList);
void valuesChanged(const ValuesChangedCommand &command);
......
......@@ -387,8 +387,10 @@ void NodeInstanceView::variantPropertiesChanged(const QList<VariantProperty>& pr
void NodeInstanceView::nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags /*propertyChange*/)
{
if (!isSkippedNode(node))
if (!isSkippedNode(node)) {
updateChildren(newPropertyParent);
nodeInstanceServer()->reparentInstances(createReparentInstancesCommand(node, newPropertyParent, oldPropertyParent));
}
}
void NodeInstanceView::nodeAboutToBeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
......@@ -676,6 +678,25 @@ NodeInstance NodeInstanceView::activeStateInstance() const
return m_activeStateInstance;
}
void NodeInstanceView::updateChildren(const NodeAbstractProperty &newPropertyParent)
{
QVector<ModelNode> childNodeVector = newPropertyParent.directSubNodes().toVector();
qint32 parentInstanceId = newPropertyParent.parentModelNode().internalId();
foreach (const ModelNode &childNode, childNodeVector) {
qint32 instanceId = childNode.internalId();
if (hasInstanceForId(instanceId)) {
NodeInstance instance = instanceForId(instanceId);
if (!instance.updateTransform())
instance.setParentId(parentInstanceId);
}
}
if (!childNodeVector.isEmpty())
emitInstancesChildrenChanged(childNodeVector);
}
void setXValue(NodeInstance &instance, const VariantProperty &variantProperty, QMultiHash<ModelNode, InformationName> &informationChangeHash)
{
instance.setX(variantProperty.value().toDouble());
......@@ -1224,8 +1245,10 @@ void NodeInstanceView::childrenChanged(const ChildrenChangedCommand &command)
foreach (qint32 instanceId, command.childrenInstances()) {
if (hasInstanceForId(instanceId)) {
NodeInstance instance = instanceForId(instanceId);
instance.setParentId(command.parentInstanceId());
childNodeVector.append(instance.modelNode());
if (instance.updateTransform()) {
instance.setParentId(command.parentInstanceId());
childNodeVector.append(instance.modelNode());
}
}
}
......
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