Commit 80d0b18f authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner.NodeInstances: Use internalId for instanceId

parent a91d137d
......@@ -19,7 +19,7 @@ class NodeInstance
{
friend class NodeInstanceView;
public:
static NodeInstance create(const ModelNode &node, qint32 instanceId);
static NodeInstance create(const ModelNode &node);
NodeInstance();
~NodeInstance();
NodeInstance(const NodeInstance &other);
......
......@@ -153,8 +153,6 @@ private: // functions
RemovePropertiesCommand createRemovePropertiesCommand(const QList<AbstractProperty> &propertyList) const;
AddImportCommand createImportCommand(const Import &import);
qint32 generateInstanceId();
void resetHorizontalAnchors(const ModelNode &node);
void resetVerticalAnchors(const ModelNode &node);
......@@ -170,8 +168,6 @@ private: //variables
uint m_blockUpdates;
QWeakPointer<NodeInstanceServerInterface> m_nodeInstanceServer;
qint32 m_instanceIdCounter;
;
};
} // namespace ProxyNodeInstanceView
......
......@@ -12,8 +12,7 @@ class ProxyNodeInstanceData
{
public:
ProxyNodeInstanceData()
: instanceId(-1),
parentInstanceId(-1),
: parentInstanceId(-1),
penWidth(1),
isAnchoredBySibling(false),
isAnchoredByChildren(false),
......@@ -23,7 +22,6 @@ public:
isInPositioner(false)
{}
qint32 instanceId;
qint32 parentInstanceId;
ModelNode modelNode;
QRectF boundingRect;
......@@ -58,12 +56,11 @@ NodeInstance::NodeInstance(ProxyNodeInstanceData *dPointer)
{
}
NodeInstance NodeInstance::create(const ModelNode &node, qint32 instanceId)
NodeInstance NodeInstance::create(const ModelNode &node)
{
ProxyNodeInstanceData *d = new ProxyNodeInstanceData;
d->modelNode = node;
d->instanceId = instanceId;
return NodeInstance(d);
}
......@@ -95,7 +92,7 @@ ModelNode NodeInstance::modelNode() const
qint32 NodeInstance::instanceId() const
{
if (d) {
return d->instanceId;
return d->modelNode.internalId();
} else {
return -1;
}
......@@ -109,7 +106,7 @@ bool NodeInstance::isValid() const
void NodeInstance::makeInvalid()
{
if (d)
d->instanceId = -1;
d->modelNode = ModelNode();
}
QRectF NodeInstance::boundingRect() const
......
......@@ -135,7 +135,6 @@ void NodeInstanceView::modelAttached(Model *model)
AbstractView::modelAttached(model);
m_nodeInstanceServer = new NodeInstanceServerProxy(this);
connect(m_nodeInstanceServer.data(), SIGNAL(processCrashed()), this, SLOT(restartProcess()));
m_instanceIdCounter = 1;
setBlockUpdates(true);
nodeInstanceServer()->createScene(createCreateSceneCommand());
......@@ -633,12 +632,7 @@ NodeInstanceServerInterface *NodeInstanceView::nodeInstanceServer() const
NodeInstance NodeInstanceView::loadNode(const ModelNode &node)
{
qint32 instanceId = 0;
if (!node.isRootNode())
instanceId = generateInstanceId();
NodeInstance instance(NodeInstance::create(node, instanceId));
NodeInstance instance(NodeInstance::create(node));
insertInstanceRelationships(instance);
......@@ -918,9 +912,4 @@ void NodeInstanceView::childrenChanged(const ChildrenChangedCommand &command)
emitCustomNotification("__instance children changed__", childNodeList);
}
qint32 NodeInstanceView::generateInstanceId()
{
return m_instanceIdCounter++;
}
}
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