diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-07-24 07:48:28 (GMT) |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-07-24 07:48:28 (GMT) |
commit | 80476372e6f4dd3e179eeba949e86a336bc8fde3 (patch) | |
tree | 9502663e814ffb6f0b1a6542e76c25e82a4a0e3b /src/declarative | |
parent | ea2f61a76f8b6075a3421f8f1dce353d8ae22b58 (diff) | |
download | Qt-80476372e6f4dd3e179eeba949e86a336bc8fde3.zip Qt-80476372e6f4dd3e179eeba949e86a336bc8fde3.tar.gz Qt-80476372e6f4dd3e179eeba949e86a336bc8fde3.tar.bz2 |
Added objectClassName now that objectType is the fully-qualified type
name.
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmldom.cpp | 23 | ||||
-rw-r--r-- | src/declarative/qml/qmldom.h | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlparser_p.h | 4 |
4 files changed, 25 insertions, 4 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 7e483cd..f0473f5 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -630,6 +630,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt) obj->url = tr.component->url(); if (tr.type) obj->typeName = tr.type->qmlTypeName(); + obj->className = tr.className; // This object is a "Component" element if (obj->metatype == &QmlComponent::staticMetaObject) { diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index 6725950..c6b7192 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -747,11 +747,11 @@ bool QmlDomObject::isValid() const } /*! - Returns the type name of this object. + Returns the fully-qualified type name of this object. - For example, the type of this object would be "QGraphicsWidget". + For example, the type of this object would be "Qt/4.6/Rect". \qml -QGraphicsWidget { } +Rect { } \endqml */ QByteArray QmlDomObject::objectType() const @@ -761,6 +761,23 @@ QByteArray QmlDomObject::objectType() const } /*! + Returns the fully-qualified type name of this object. + + For example, the type of this object would be "Qt/4.6/Rect". + \qml +Rect { } + \endqml +*/ +QByteArray QmlDomObject::objectClassName() const +{ + if (d->object) + return d->object->className; + else + return QByteArray(); +} + + +/*! Returns the QML id assigned to this object, or an empty QByteArray if no id has been assigned. diff --git a/src/declarative/qml/qmldom.h b/src/declarative/qml/qmldom.h index 339570b..1c70206 100644 --- a/src/declarative/qml/qmldom.h +++ b/src/declarative/qml/qmldom.h @@ -150,6 +150,7 @@ public: bool isValid() const; QByteArray objectType() const; + QByteArray objectClassName() const; QString objectId() const; void setObjectId(const QByteArray &); diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h index 927c9e6..120af75 100644 --- a/src/declarative/qml/qmlparser_p.h +++ b/src/declarative/qml/qmlparser_p.h @@ -115,8 +115,10 @@ namespace QmlParser int type; // The url of this object if it is an external type. Used by the DOM QUrl url; - // The name of this type + // The fully-qualified name of this type QByteArray typeName; + // The class name + QByteArray className; // The id assigned to the object (if any). Set by the QmlCompiler QString id; // The id index assigned to the object (if any). Set by the QmlCompiler |