Commit 748361bb authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

Fixed crash when opening files with bindings on "when" properties

Task-number: BAUHAUS-430
Reviewed-by: marco
parent fe13a9fa
......@@ -28,6 +28,8 @@
**************************************************************************/
#include "qmlstatenodeinstance.h"
#include "nodeabstractproperty.h"
#include <private/qdeclarativestategroup_p.h>
namespace QmlDesigner {
......@@ -105,5 +107,25 @@ bool QmlStateNodeInstance::isStateActive() const
return (stateGroup()->state() == property("name"));
}
void QmlStateNodeInstance::setPropertyVariant(const QString &name, const QVariant &value)
{
bool hasParent = modelNode().hasParentProperty();
bool isStateOfTheRootModelNode = !hasParent || (hasParent && modelNode().parentProperty().parentModelNode().isRootNode());
if (name == "when" && isStateOfTheRootModelNode)
return;
ObjectNodeInstance::setPropertyVariant(name, value);
}
void QmlStateNodeInstance::setPropertyBinding(const QString &name, const QString &expression)
{
bool hasParent = modelNode().hasParentProperty();
bool isStateOfTheRootModelNode = !hasParent || (hasParent && modelNode().parentProperty().parentModelNode().isRootNode());
if (name == "when" && isStateOfTheRootModelNode)
return;
ObjectNodeInstance::setPropertyBinding(name, expression);
}
} // namespace Internal
} // namespace QmlDesigner
......@@ -45,6 +45,9 @@ public:
static Pointer create(const NodeMetaInfo &metaInfo, QDeclarativeContext *context, QObject *objectToBeWrapped);
void setPropertyVariant(const QString &name, const QVariant &value);
void setPropertyBinding(const QString &name, const QString &expression);
void activateState();
void deactivateState();
void refreshState();
......
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