diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-05 09:56:22 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-05 09:56:22 (GMT) |
commit | 315d460e6a4ce5fa8c9fcb90474d43174b5e0b0d (patch) | |
tree | fa3275cac58039beb2deb64783f029a71b4b3bd2 /src/declarative/qml | |
parent | 1a7cee240904a3aea112fc102901066fe26d45d6 (diff) | |
download | Qt-315d460e6a4ce5fa8c9fcb90474d43174b5e0b0d.zip Qt-315d460e6a4ce5fa8c9fcb90474d43174b5e0b0d.tar.gz Qt-315d460e6a4ce5fa8c9fcb90474d43174b5e0b0d.tar.bz2 |
Tests
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qmlmetatype.cpp | 45 | ||||
-rw-r--r-- | src/declarative/qml/qmlmetatype.h | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlprivate.h | 3 |
3 files changed, 6 insertions, 45 deletions
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp index 6ecaa9f..5fb2f50 100644 --- a/src/declarative/qml/qmlmetatype.cpp +++ b/src/declarative/qml/qmlmetatype.cpp @@ -134,7 +134,6 @@ public: QmlCustomParser *m_customParser; mutable volatile bool m_isSetup:1; mutable QList<QmlProxyMetaObject::ProxyData> m_metaObjects; - mutable QByteArray m_hash; }; QmlTypePrivate::QmlTypePrivate() @@ -259,27 +258,6 @@ void QmlTypePrivate::init() const m_metaObjects.at(ii).metaObject->methodOffset(); } - // Calculate hash - QByteArray hashData; - - const QMetaObject *myMetaObject = m_metaObjects.isEmpty()?m_baseMetaObject:m_metaObjects.first().metaObject; - - for (int ii = 0; ii < myMetaObject->propertyCount(); ++ii) { - QMetaProperty prop = myMetaObject->property(ii); - hashData.append(prop.type()); - hashData.append("|"); - hashData.append(prop.name()); - hashData.append("|"); - } - - for (int ii = 0; ii < myMetaObject->methodCount(); ++ii) { - QMetaMethod method = myMetaObject->method(ii); - hashData.append(method.signature()); - hashData.append("|"); - } - - m_hash = QCryptographicHash::hash(hashData, QCryptographicHash::Md5); - m_isSetup = true; lock.unlock(); } @@ -297,13 +275,6 @@ QByteArray QmlType::qmlTypeName() const return d->m_name; } -QByteArray QmlType::hash() const -{ - d->init(); - - return d->m_hash; -} - QObject *QmlType::create() const { d->init(); @@ -804,17 +775,6 @@ const char *QmlMetaType::interfaceIId(int userType) return 0; } -bool QmlMetaType::isObject(const QMetaObject *mo) -{ - // ### Huh? - while(mo) { - if (mo == &QObject::staticMetaObject) - return true; - mo = mo->superClass(); - } - return false; -} - bool QmlMetaType::isQmlList(int userType) { QReadLocker lock(metaTypeDataLock()); @@ -851,6 +811,9 @@ int QmlMetaType::listCount(const QVariant &v) QVariant QmlMetaType::listAt(const QVariant &v, int idx) { + if (idx < 0) + return QVariant(); + int userType = v.userType(); QReadLocker lock(metaTypeDataLock()); @@ -861,7 +824,7 @@ QVariant QmlMetaType::listAt(const QVariant &v, int idx) if (type && type->qListTypeId() == userType) return type->listAt(v, idx); else - return 0; + return QVariant(); } /*! diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h index e90c367..1f493f8 100644 --- a/src/declarative/qml/qmlmetatype.h +++ b/src/declarative/qml/qmlmetatype.h @@ -97,7 +97,6 @@ public: static bool isInterface(int); static const char *interfaceIId(int); static bool isObject(int); - static bool isObject(const QMetaObject *); static bool isList(int); static bool isList(const QVariant &); static bool isQmlList(int); @@ -121,8 +120,6 @@ public: int minorVersion() const; bool availableInVersion(int vmajor, int vminor) const; - QByteArray hash() const; - QObject *create() const; QmlCustomParser *customParser() const; diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h index e5b1060..0eec43c 100644 --- a/src/declarative/qml/qmlprivate.h +++ b/src/declarative/qml/qmlprivate.h @@ -283,7 +283,8 @@ int QmlPrivate::list_op(QmlPrivate::ListOp op, int val, } break; case QmlPrivate::Value: - *((QVariant *)*out) = QVariant::fromValue(list->at(val)); + if (list->count() <= val) *((QVariant *)*out) = QVariant(); + else *((QVariant *)*out) = QVariant::fromValue(list->at(val)); break; } return 0; |