Commit 948990aa authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Add NodeAbstractProperty::parentProperty()



Change-Id: Ibb4e68cf80ab1d23680cfaf7a2c638fea5d6c5a0
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 0673a6a2
......@@ -56,6 +56,7 @@ public:
bool isEmpty() const;
int count() const;
int indexOf(const ModelNode &node) const;
NodeAbstractProperty parentProperty() const;
const QList<ModelNode> allSubNodes();
const QList<ModelNode> directSubNodes() const;
......
......@@ -116,6 +116,21 @@ int NodeAbstractProperty::indexOf(const ModelNode &node) const
return property->indexOf(node.internalNode());
}
NodeAbstractProperty NodeAbstractProperty::parentProperty() const
{
if (!isValid()) {
Q_ASSERT_X(isValid(), Q_FUNC_INFO, "property is invalid");
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, name());
}
if (internalNode()->parentProperty().isNull()) {
Q_ASSERT_X(internalNode()->parentProperty(), Q_FUNC_INFO, "parentProperty is invalid");
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, "parent");
}
return NodeAbstractProperty(internalNode()->parentProperty()->name(), internalNode()->parentProperty()->propertyOwner(), model(), view());
}
int NodeAbstractProperty::count() const
{
Internal::InternalNodeAbstractProperty::Pointer property = internalNode()->nodeAbstractProperty(name());
......
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