summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlexpression.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-02 13:51:09 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-05 02:40:50 (GMT)
commit43d3c9127e36b8f3134a173736d63140b381899f (patch)
treea12bf4e273590f222975966dba0caa0a509feddd /src/declarative/qml/qmlexpression.cpp
parent114adc64fe8deb7d59e608924355f64810f8fe64 (diff)
downloadQt-43d3c9127e36b8f3134a173736d63140b381899f.zip
Qt-43d3c9127e36b8f3134a173736d63140b381899f.tar.gz
Qt-43d3c9127e36b8f3134a173736d63140b381899f.tar.bz2
Fix test failures
Diffstat (limited to 'src/declarative/qml/qmlexpression.cpp')
-rw-r--r--src/declarative/qml/qmlexpression.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index adf5261..61c14a9 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -296,13 +296,8 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope)
QList<QObject *> list;
for (int ii = 0; ii < length; ++ii) {
QScriptValue arrayItem = svalue.property(ii);
- QObject *d =
- qvariant_cast<QObject *>(arrayItem.data().toVariant());
- if (d) {
- list << d;
- } else {
- list << 0;
- }
+ QObject *d = arrayItem.toQObject();
+ list << d;
}
rv = QVariant::fromValue(list);
}
@@ -316,13 +311,10 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope)
!svalue.isQMetaObject() &&
!svalue.isQObject() &&
!svalue.isRegExp()) {
- QScriptValue objValue = svalue.data();
- if (objValue.isValid()) {
- QVariant var = objValue.toVariant();
- if (var.userType() >= (int)QVariant::UserType &&
- QmlMetaType::isObject(var.userType()))
- rv = var;
- }
+
+ QObject *o = svalue.toQObject();
+ if (o)
+ return qVariantFromValue(o);
}
if (rv.isNull())
rv = svalue.toVariant();