forked from qt-creator/qt-creator
QmlDesigner: Update the parent too for bypass manipulation
Task-number: QTCREATORBUG-12570 Change-Id: I038bfb233c0a8a734ae82b1b31fca8f5aa8c9763 Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
@@ -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)
|
void MoveManipulator::synchronizeInstanceParent(const QList<FormEditorItem*> &itemList)
|
||||||
|
@@ -136,6 +136,7 @@ public:
|
|||||||
|
|
||||||
NodeInstance activeStateInstance() const;
|
NodeInstance activeStateInstance() const;
|
||||||
|
|
||||||
|
void updateChildren(const NodeAbstractProperty &newPropertyParent);
|
||||||
void updatePosition(const QList<VariantProperty>& propertyList);
|
void updatePosition(const QList<VariantProperty>& propertyList);
|
||||||
|
|
||||||
void valuesChanged(const ValuesChangedCommand &command);
|
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*/)
|
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));
|
nodeInstanceServer()->reparentInstances(createReparentInstancesCommand(node, newPropertyParent, oldPropertyParent));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeInstanceView::nodeAboutToBeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
|
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;
|
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)
|
void setXValue(NodeInstance &instance, const VariantProperty &variantProperty, QMultiHash<ModelNode, InformationName> &informationChangeHash)
|
||||||
{
|
{
|
||||||
instance.setX(variantProperty.value().toDouble());
|
instance.setX(variantProperty.value().toDouble());
|
||||||
@@ -1224,8 +1245,10 @@ void NodeInstanceView::childrenChanged(const ChildrenChangedCommand &command)
|
|||||||
foreach (qint32 instanceId, command.childrenInstances()) {
|
foreach (qint32 instanceId, command.childrenInstances()) {
|
||||||
if (hasInstanceForId(instanceId)) {
|
if (hasInstanceForId(instanceId)) {
|
||||||
NodeInstance instance = instanceForId(instanceId);
|
NodeInstance instance = instanceForId(instanceId);
|
||||||
instance.setParentId(command.parentInstanceId());
|
if (instance.updateTransform()) {
|
||||||
childNodeVector.append(instance.modelNode());
|
instance.setParentId(command.parentInstanceId());
|
||||||
|
childNodeVector.append(instance.modelNode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user