diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstance.h b/src/plugins/qmldesigner/designercore/include/nodeinstance.h index 3c2d41a1cf2c8319a34141a4beb990de367d0adc..a741f53b6932867c0cd574e31b2b13da834e363d 100644 --- a/src/plugins/qmldesigner/designercore/include/nodeinstance.h +++ b/src/plugins/qmldesigner/designercore/include/nodeinstance.h @@ -118,6 +118,7 @@ public: double opacity() const; QVariant property(const QString &name) const; QVariant defaultValue(const QString &name) const; + QString instanceType(const QString &name) const; bool isValid() const; void makeInvalid(); diff --git a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h index b8ff11c36320291291a65bc9b3ffbdbf42d76cca..9bdb53793b4f41535338d1145ba3517e06af435a 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h +++ b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h @@ -63,6 +63,7 @@ public: NodeListProperty nodeListProperty(const QString &name) const; QVariant instanceValue(const QString &name) const; + QString QmlObjectNode::instanceType(const QString &name) const; bool hasProperty(const QString &name) const; bool hasBindingProperty(const QString &name) const; diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp index 3c95bff339662cd1eece4daed470f9f8d194c90a..e0cba857fe7f743a33114349dcec2080441c830a 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp @@ -427,6 +427,14 @@ QVariant NodeInstance::defaultValue(const QString &name) const return m_nodeInstance->resetValue(name); } +/*! +\brief Returns the type of the property of this NodeInstance. +*/ +QString NodeInstance::instanceType(const QString &name) const +{ + return m_nodeInstance->instanceType(name); +} + /*! \brief Returns if the NodeInstance is valid. \returns true if the NodeInstance is valid diff --git a/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.cpp b/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.cpp index e52ca995d7c54c2b4bedc6a6782633ab25830245..fe43cdd5b97a65b36fe044fd851a3e981d456732 100644 --- a/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.cpp +++ b/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.cpp @@ -617,6 +617,14 @@ QVariant ObjectNodeInstance::property(const QString &name) const return property.read(); } +QString ObjectNodeInstance::instanceType(const QString &name) const +{ + QDeclarativeProperty property(object(), name, context()); + if (!property.isValid()) + return QLatin1String("undefined"); + return property.propertyTypeName(); +} + void ObjectNodeInstance::setDeleteHeldInstance(bool deleteInstance) { diff --git a/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.h b/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.h index ef404b1fe7ef6e26a29b155e0a7c58994b0c4197..982292fb3cadb5adcf083147a583dad4342a52a2 100644 --- a/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.h +++ b/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.h @@ -144,6 +144,7 @@ public: virtual QVariant property(const QString &name) const; virtual void resetProperty(const QString &name); virtual void refreshProperty(const QString &name); + virtual QString instanceType(const QString &name) const; void createDynamicProperty(const QString &name, const QString &typeName); void setDeleteHeldInstance(bool deleteInstance); diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp index 8fe7a5ac86dbacadbec94eb457b87f4d78598e4b..85127ce0823177d97de0621ebe83e618b6f142fa 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp @@ -387,6 +387,11 @@ QVariant QmlObjectNode::instanceValue(const ModelNode &modelNode, const QString return modelView->instanceForModelNode(modelNode).property(name); } +QString QmlObjectNode::instanceType(const QString &name) const +{ + return nodeInstance().instanceType(name); +} + NodeInstance QmlObjectNode::nodeInstance() const { return qmlModelView()->nodeInstanceView()->instanceForNode(modelNode());