forked from qt-creator/qt-creator
QmlDesigner: Always test if there is a instance for an id or object
Change-Id: I90ff8861de8879e300932bd61afb29f8ec3b9fc4 Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
+4
-2
@@ -71,8 +71,10 @@ void QmlPropertyChangesNodeInstance::setPropertyVariant(const PropertyName &name
|
||||
changesObject()->changeValue(name, value);
|
||||
QObject *targetObject = changesObject()->object();
|
||||
if (targetObject && nodeInstanceServer()->activeStateInstance().isWrappingThisObject(changesObject()->state())) {
|
||||
ServerNodeInstance targetInstance = nodeInstanceServer()->instanceForObject(targetObject);
|
||||
targetInstance.setPropertyVariant(name, value);
|
||||
if (nodeInstanceServer()->hasInstanceForObject(targetObject)) {
|
||||
ServerNodeInstance targetInstance = nodeInstanceServer()->instanceForObject(targetObject);
|
||||
targetInstance.setPropertyVariant(name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,12 +64,13 @@ QmlStateNodeInstance::Pointer
|
||||
|
||||
void QmlStateNodeInstance::activateState()
|
||||
{
|
||||
if (stateGroup()) {
|
||||
if (!isStateActive()) {
|
||||
nodeInstanceServer()->setStateInstance(nodeInstanceServer()->instanceForObject(object()));
|
||||
stateGroup()->setState(property("name").toString());
|
||||
}
|
||||
if (stateGroup()
|
||||
&& !isStateActive()
|
||||
&& nodeInstanceServer()->hasInstanceForObject(object())) {
|
||||
nodeInstanceServer()->setStateInstance(nodeInstanceServer()->instanceForObject(object()));
|
||||
stateGroup()->setState(property("name").toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void QmlStateNodeInstance::deactivateState()
|
||||
|
||||
+15
-9
@@ -199,9 +199,11 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
||||
void Qt5InformationNodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
|
||||
{
|
||||
foreach (const ReparentContainer &container, command.reparentInstances()) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
m_parentChangedSet.insert(instance);
|
||||
if (hasInstanceForId(container.instanceId())) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
m_parentChangedSet.insert(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,9 +224,11 @@ void Qt5InformationNodeInstanceServer::createScene(const CreateSceneCommand &com
|
||||
|
||||
QList<ServerNodeInstance> instanceList;
|
||||
foreach (const InstanceContainer &container, command.instances()) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
if (hasInstanceForId(container.instanceId())) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,9 +273,11 @@ void Qt5InformationNodeInstanceServer::completeComponent(const CompleteComponent
|
||||
|
||||
QList<ServerNodeInstance> instanceList;
|
||||
foreach (qint32 instanceId, command.instances()) {
|
||||
ServerNodeInstance instance = instanceForId(instanceId);
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
if (hasInstanceForId(instanceId)) {
|
||||
ServerNodeInstance instance = instanceForId(instanceId);
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,9 +132,11 @@ void Qt5RenderNodeInstanceServer::createScene(const CreateSceneCommand &command)
|
||||
|
||||
QList<ServerNodeInstance> instanceList;
|
||||
foreach (const InstanceContainer &container, command.instances()) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
if (hasInstanceForId(container.instanceId())) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,10 +156,12 @@ void Qt5RenderNodeInstanceServer::completeComponent(const CompleteComponentComma
|
||||
|
||||
QList<ServerNodeInstance> instanceList;
|
||||
foreach (qint32 instanceId, command.instances()) {
|
||||
ServerNodeInstance instance = instanceForId(instanceId);
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
m_dirtyInstanceSet.insert(instance);
|
||||
if (hasInstanceForId(instanceId)) {
|
||||
ServerNodeInstance instance = instanceForId(instanceId);
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
m_dirtyInstanceSet.insert(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,9 +190,11 @@ void Qt5TestNodeInstanceServer::removeProperties(const RemovePropertiesCommand &
|
||||
void Qt5TestNodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
|
||||
{
|
||||
foreach (const ReparentContainer &container, command.reparentInstances()) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instance.reparent(instanceForId(container.oldParentInstanceId()), container.oldParentProperty(), instanceForId(container.newParentInstanceId()), container.newParentProperty());
|
||||
if (hasInstanceForId(container.instanceId())) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instance.reparent(instanceForId(container.oldParentInstanceId()), container.oldParentProperty(), instanceForId(container.newParentInstanceId()), container.newParentProperty());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,16 +140,18 @@ QTransform GraphicsObjectNodeInstance::transform() const
|
||||
if (!nodeInstanceServer()->hasInstanceForObject(object()))
|
||||
return sceneTransform();
|
||||
|
||||
ServerNodeInstance nodeInstanceParent = nodeInstanceServer()->instanceForObject(object()).parent();
|
||||
if (nodeInstanceServer()->hasInstanceForObject(object())) {
|
||||
ServerNodeInstance nodeInstanceParent = nodeInstanceServer()->instanceForObject(object()).parent();
|
||||
|
||||
if (!nodeInstanceParent.isValid())
|
||||
return sceneTransform();
|
||||
if (!nodeInstanceParent.isValid())
|
||||
return sceneTransform();
|
||||
|
||||
QGraphicsObject *graphicsObjectParent = qobject_cast<QGraphicsObject*>(nodeInstanceParent.internalObject());
|
||||
if (graphicsObjectParent)
|
||||
return graphicsObject()->itemTransform(graphicsObjectParent);
|
||||
else
|
||||
return sceneTransform();
|
||||
QGraphicsObject *graphicsObjectParent = qobject_cast<QGraphicsObject*>(nodeInstanceParent.internalObject());
|
||||
if (graphicsObjectParent)
|
||||
return graphicsObject()->itemTransform(graphicsObjectParent);
|
||||
}
|
||||
|
||||
return sceneTransform();
|
||||
}
|
||||
|
||||
QTransform GraphicsObjectNodeInstance::customTransform() const
|
||||
|
||||
+4
-2
@@ -71,8 +71,10 @@ void QmlPropertyChangesNodeInstance::setPropertyVariant(const PropertyName &name
|
||||
changesObject()->changeValue(name, value);
|
||||
QObject *targetObject = changesObject()->object();
|
||||
if (targetObject && nodeInstanceServer()->activeStateInstance().isWrappingThisObject(changesObject()->state())) {
|
||||
ServerNodeInstance targetInstance = nodeInstanceServer()->instanceForObject(targetObject);
|
||||
targetInstance.setPropertyVariant(name, value);
|
||||
if (nodeInstanceServer()->hasInstanceForObject(targetObject)) {
|
||||
ServerNodeInstance targetInstance = nodeInstanceServer()->instanceForObject(targetObject);
|
||||
targetInstance.setPropertyVariant(name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,11 +64,11 @@ QmlStateNodeInstance::Pointer
|
||||
|
||||
void QmlStateNodeInstance::activateState()
|
||||
{
|
||||
if (stateGroup()) {
|
||||
if (!isStateActive()) {
|
||||
nodeInstanceServer()->setStateInstance(nodeInstanceServer()->instanceForObject(object()));
|
||||
stateGroup()->setState(property("name").toString());
|
||||
}
|
||||
if (stateGroup()
|
||||
&& !isStateActive()
|
||||
&& nodeInstanceServer()->hasInstanceForObject(object())) {
|
||||
nodeInstanceServer()->setStateInstance(nodeInstanceServer()->instanceForObject(object()));
|
||||
stateGroup()->setState(property("name").toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-9
@@ -198,9 +198,11 @@ void Qt4InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
||||
void Qt4InformationNodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
|
||||
{
|
||||
foreach(const ReparentContainer &container, command.reparentInstances()) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
m_parentChangedSet.insert(instance);
|
||||
if (hasInstanceForId(container.instanceId())) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
m_parentChangedSet.insert(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,9 +223,11 @@ void Qt4InformationNodeInstanceServer::createScene(const CreateSceneCommand &com
|
||||
|
||||
QList<ServerNodeInstance> instanceList;
|
||||
foreach(const InstanceContainer &container, command.instances()) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
if (hasInstanceForId(container.instanceId())) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,9 +267,11 @@ void Qt4InformationNodeInstanceServer::completeComponent(const CompleteComponent
|
||||
|
||||
QList<ServerNodeInstance> instanceList;
|
||||
foreach(qint32 instanceId, command.instances()) {
|
||||
ServerNodeInstance instance = instanceForId(instanceId);
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
if (hasInstanceForId(instanceId)) {
|
||||
ServerNodeInstance instance = instanceForId(instanceId);
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,9 +154,11 @@ void Qt4RenderNodeInstanceServer::createScene(const CreateSceneCommand &command)
|
||||
|
||||
QList<ServerNodeInstance> instanceList;
|
||||
foreach(const InstanceContainer &container, command.instances()) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
if (hasInstanceForId(container.instanceId())) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,9 +178,11 @@ void Qt4RenderNodeInstanceServer::completeComponent(const CompleteComponentComma
|
||||
|
||||
QList<ServerNodeInstance> instanceList;
|
||||
foreach(qint32 instanceId, command.instances()) {
|
||||
ServerNodeInstance instance = instanceForId(instanceId);
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
if (hasInstanceForId(instanceId)) {
|
||||
ServerNodeInstance instance = instanceForId(instanceId);
|
||||
if (instance.isValid()) {
|
||||
instanceList.append(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user