summaryrefslogtreecommitdiff
path: root/src/declarative/qml/qdeclarativeengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qdeclarativeengine.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index c67ea236..3fb3b72f 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -2129,8 +2129,20 @@ QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val
else if (dc == contextClass)
return QVariant();
+ bool containsQObjects = false;
+
+ if (val.isArray()) {
+ int length = val.property(QLatin1String("length")).toInt32();
+ for (int ii = 0; ii < length; ++ii) {
+ if (val.property(ii).isQObject()) {
+ containsQObjects = true;
+ break;
+ }
+ }
+ }
+
// Convert to a QList<QObject*> only if val is an array and we were explicitly hinted
- if (hint == qMetaTypeId<QList<QObject *> >() && val.isArray()) {
+ if (hint == qMetaTypeId<QList<QObject *> >() && val.isArray() && containsQObjects) {
QList<QObject *> list;
int length = val.property(QLatin1String("length")).toInt32();
for (int ii = 0; ii < length; ++ii) {