Skip to content
Snippets Groups Projects
Commit a85fae4b authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner: implenting expression() in QmlObjectNode

This function returns the expression in a certain state
parent 8999b35f
No related branches found
No related tags found
No related merge requests found
...@@ -68,6 +68,7 @@ public: ...@@ -68,6 +68,7 @@ public:
bool hasBindingProperty(const QString &name) const; bool hasBindingProperty(const QString &name) const;
bool propertyAffectedByCurrentState(const QString &name) const; bool propertyAffectedByCurrentState(const QString &name) const;
QVariant modelValue(const QString &name) const; QVariant modelValue(const QString &name) const;
QString expression(const QString &name) const;
bool isInBaseState() const; bool isInBaseState() const;
QmlPropertyChanges propertyChangeForCurrentState() const; QmlPropertyChanges propertyChangeForCurrentState() const;
......
...@@ -175,6 +175,25 @@ QVariant QmlObjectNode::modelValue(const QString &name) const ...@@ -175,6 +175,25 @@ QVariant QmlObjectNode::modelValue(const QString &name) const
return propertyChanges.modelNode().variantProperty(name).value(); return propertyChanges.modelNode().variantProperty(name).value();
} }
QString QmlObjectNode::expression(const QString &name) const
{
if (!isValid())
throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
if (currentState().isBaseState())
return modelNode().bindingProperty(name).expression();
if (!currentState().hasPropertyChanges(modelNode()))
return modelNode().bindingProperty(name).expression();
QmlPropertyChanges propertyChanges(currentState().propertyChanges(modelNode()));
if (!propertyChanges.modelNode().hasProperty(name))
return modelNode().bindingProperty(name).expression();
return propertyChanges.modelNode().bindingProperty(name).expression();
}
/*! \brief returns if ObjectNode is the BaseState /*! \brief returns if ObjectNode is the BaseState
\return true if the ObjectNode is in the BaseState \return true if the ObjectNode is in the BaseState
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment