diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 78267b728845ab03c519ecb3d1d903b16b81583b..47353fe135e1e3c036dae5f58dc1cedf26ff0a9d 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -963,6 +963,25 @@ bool QmlObjectValue::isPointer(const QString &propertyName) const return false; } +bool QmlObjectValue::hasLocalProperty(const QString &typeName) const +{ + int idx = _metaObject->propertyIndex(typeName); + if (idx == -1) + return false; + return true; +} + +bool QmlObjectValue::hasProperty(const QString &propertyName) const +{ + for (const FakeMetaObject *iter = _metaObject; iter; iter = iter->superClass()) { + int propIdx = iter->propertyIndex(propertyName); + if (propIdx != -1) { + return true; + } + } + return false; +} + bool QmlObjectValue::enumContainsKey(const QString &enumName, const QString &enumKeyName) const { int idx = _metaObject->enumeratorIndex(enumName); @@ -976,6 +995,15 @@ bool QmlObjectValue::enumContainsKey(const QString &enumName, const QString &enu return false; } +QStringList QmlObjectValue::keysForEnum(const QString &enumName) const +{ + int idx = _metaObject->enumeratorIndex(enumName); + if (idx == -1) + return QStringList(); + const FakeMetaEnum &fme = _metaObject->enumerator(idx); + return fme.keys(); +} + // Returns true if this object is in a package or if there is an object that // has this one in its prototype chain and is itself in a package. bool QmlObjectValue::hasChildInPackage() const diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 04f29e786890752d9612f01e27f8e8bddc70d5c5..76f0a97522897f180de83c2d8f4bdd12d4e2b569 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -427,7 +427,10 @@ public: bool isWritable(const QString &propertyName) const; bool isPointer(const QString &propertyName) const; bool isEnum(const QString &typeName) const; + bool hasLocalProperty(const QString &typeName) const; + bool hasProperty(const QString &typeName) const; bool enumContainsKey(const QString &enumName, const QString &enumKeyName) const; + QStringList keysForEnum(const QString &enumName) const; bool hasChildInPackage() const; protected: