summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qmlbasicscript.cpp6
-rw-r--r--src/declarative/qml/qmlcompiler.cpp5
-rw-r--r--src/declarative/qml/qmlcomponent.cpp1
-rw-r--r--src/declarative/qml/qmldom.cpp10
-rw-r--r--src/declarative/qml/qmldom.h1
-rw-r--r--src/declarative/qml/qmlengine.cpp22
-rw-r--r--src/declarative/qml/qmlparser_p.h2
7 files changed, 39 insertions, 8 deletions
diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp
index a679532..f02a176 100644
--- a/src/declarative/qml/qmlbasicscript.cpp
+++ b/src/declarative/qml/qmlbasicscript.cpp
@@ -830,7 +830,8 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
if (n.type == QmlBasicScriptNodeCache::Invalid || state == Reset) {
context->engine()->d_func()->loadCache(n, QLatin1String(id), static_cast<QmlContextPrivate*>(context->d_ptr));
- state = Incremental;
+ if (state != Reset)
+ state = Incremental;
}
if(!n.isValid())
@@ -855,7 +856,8 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
} else if (n.type == QmlBasicScriptNodeCache::Invalid || state == Reset) {
context->engine()->d_func()->fetchCache(n, QLatin1String(id), obj);
guard(n);
- state = Incremental;
+ if (state != Reset)
+ state = Incremental;
} else if (!valid(n, obj)) {
clearCache(dataCache);
*cached = Reset;
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 d2608c8..42b40b6 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/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 36b6424..8c926b7 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -1160,14 +1160,26 @@ QVariant QmlExpression::value()
}
rv = QVariant::fromValue(list);
}
- } else if (svalue.isObject()) {
+ } else if (svalue.isObject() &&
+ !svalue.isNumber() &&
+ !svalue.isString() &&
+ !svalue.isDate() &&
+ !svalue.isError() &&
+ !svalue.isFunction() &&
+ !svalue.isNull() &&
+ !svalue.isQMetaObject() &&
+ !svalue.isQObject() &&
+ !svalue.isRegExp()) {
QScriptValue objValue = svalue.data();
- if (objValue.isValid())
- rv = objValue.toVariant();
+ if (objValue.isValid()) {
+ QVariant var = objValue.toVariant();
+ if (var.userType() >= (int)QVariant::UserType &&
+ QmlMetaType::isObject(var.userType()))
+ rv = var;
+ }
}
- if (rv.isNull()) {
+ if (rv.isNull())
rv = svalue.toVariant();
- }
for (int i = 0; i < context()->d_func()->scopeChain.size(); ++i) {
scriptEngine->currentContext()->popScope();
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).