diff options
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 5 | ||||
-rw-r--r-- | src/declarative/qml/qmlcomponent.cpp | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmldom.cpp | 10 | ||||
-rw-r--r-- | src/declarative/qml/qmldom.h | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlparser_p.h | 2 |
5 files changed, 18 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 8297ac4..cb0c571 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -570,7 +570,10 @@ void QmlCompiler::compileTree(Object *tree) bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt) { Q_ASSERT (obj->type != -1); - obj->metatype = output->types.at(obj->type).metaObject(); + const QmlCompiledData::TypeReference &tr = output->types.at(obj->type); + obj->metatype = tr.metaObject(); + if (tr.component) + obj->url = tr.component->url(); if (output->types.at(obj->type).className == "Component") { COMPILE_CHECK(compileComponent(obj, ctxt)); diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index f90af4a..3429813 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -296,6 +296,7 @@ QmlComponent::QmlComponent(QmlEngine *engine, QmlCompiledComponent *cc, int star cc->addref(); d->start = start; d->count = count; + d->url = cc->url; } /*! diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index be58071..5271dc5 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -791,6 +791,16 @@ int QmlDomObject::length() const return 0; } +// Returns the URL of the type, if it is an external type, or an empty URL if +// not +QUrl QmlDomObject::url() const +{ + if (d && d->object) + return d->object->url; + else + return QUrl(); +} + QmlDomBasicValuePrivate::QmlDomBasicValuePrivate() : value(0) { diff --git a/src/declarative/qml/qmldom.h b/src/declarative/qml/qmldom.h index fde35a8..ab3e39f 100644 --- a/src/declarative/qml/qmldom.h +++ b/src/declarative/qml/qmldom.h @@ -143,6 +143,7 @@ public: int position() const; int length() const; + QUrl url() const; private: friend class QmlDomDocument; friend class QmlDomComponent; diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h index a38ce69..78040da 100644 --- a/src/declarative/qml/qmlparser_p.h +++ b/src/declarative/qml/qmlparser_p.h @@ -102,6 +102,8 @@ namespace QmlParser // QmlCompiledData::types array, or -1 if the object is a fetched // object. int type; + // The url of this object if it is an external type. Used by the DOM + QUrl url; // The name of this type QByteArray typeName; // The id assigned to the object (if any). |