diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-09-16 08:22:48 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-09-16 08:22:48 (GMT) |
commit | 78f0dd0f00506139eab54e7dc50f8980df78da63 (patch) | |
tree | 9ec0f0256618446f4dd08be34eceb51852984074 /src/declarative/qml | |
parent | 5d35dbc3552f722cf4de220d8737e8201e4f61e5 (diff) | |
parent | 30377d51a8568b9b778b58a63fb036e35a879124 (diff) | |
download | Qt-78f0dd0f00506139eab54e7dc50f8980df78da63.zip Qt-78f0dd0f00506139eab54e7dc50f8980df78da63.tar.gz Qt-78f0dd0f00506139eab54e7dc50f8980df78da63.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qmetaobjectbuilder.cpp | 32 | ||||
-rw-r--r-- | src/declarative/qml/qmetaobjectbuilder_p.h | 6 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlinfo.cpp | 6 | ||||
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.cpp | 8 |
5 files changed, 49 insertions, 6 deletions
diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp index 58ee454..e7a7591 100644 --- a/src/declarative/qml/qmetaobjectbuilder.cpp +++ b/src/declarative/qml/qmetaobjectbuilder.cpp @@ -264,7 +264,11 @@ public: QList<QByteArray> classInfoNames; QList<QByteArray> classInfoValues; QList<QMetaEnumBuilderPrivate> enumerators; +#ifdef Q_NO_DATA_RELOCATION + QList<QMetaObjectAccessor> relatedMetaObjects; +#else QList<const QMetaObject *> relatedMetaObjects; +#endif int flags; }; @@ -688,7 +692,11 @@ int QMetaObjectBuilder::addClassInfo(const QByteArray& name, const QByteArray& v \sa relatedMetaObjectCount(), relatedMetaObject() \sa removeRelatedMetaObject() */ +#ifdef Q_NO_DATA_RELOCATION +int QMetaObjectBuilder::addRelatedMetaObject(const QMetaObjectAccessor &meta) +#else int QMetaObjectBuilder::addRelatedMetaObject(const QMetaObject *meta) +#endif { Q_ASSERT(meta); int index = d->relatedMetaObjects.size(); @@ -761,10 +769,15 @@ void QMetaObjectBuilder::addMetaObject } if ((members & RelatedMetaObjects) != 0) { +#ifdef Q_NO_DATA_RELOCATION + const QMetaObjectAccessor *objects = 0; +#else const QMetaObject **objects; if (priv(prototype->d.data)->revision < 2) { objects = (const QMetaObject **)(prototype->d.extradata); - } else { + } else +#endif + { const QMetaObjectExtraData *extra = (const QMetaObjectExtraData *)(prototype->d.extradata); if (extra) objects = extra->objects; @@ -855,7 +868,11 @@ QMetaEnumBuilder QMetaObjectBuilder::enumerator(int index) const const QMetaObject *QMetaObjectBuilder::relatedMetaObject(int index) const { if (index >= 0 && index < d->relatedMetaObjects.size()) +#ifdef Q_NO_DATA_RELOCATION + return &((*(d->relatedMetaObjects[index]))()); +#else return d->relatedMetaObjects[index]; +#endif else return 0; } @@ -1390,8 +1407,13 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, reinterpret_cast<QMetaObjectExtraData *>(buf + size); size += sizeof(QMetaObjectExtraData); ALIGN(size, QMetaObject *); +#ifdef Q_NO_DATA_RELOCATION + QMetaObjectAccessor *objects = + reinterpret_cast<QMetaObjectAccessor *>(buf + size); +#else const QMetaObject **objects = reinterpret_cast<const QMetaObject **>(buf + size); +#endif if (buf) { if (d->relatedMetaObjects.size() > 0) { extra->objects = objects; @@ -1588,10 +1610,14 @@ void QMetaObjectBuilder::serialize(QDataStream& stream) const } // Write the related meta objects. +#ifdef Q_NO_DATA_RELOCATION + //### What do we do here? +#else for (index = 0; index < d->relatedMetaObjects.size(); ++index) { const QMetaObject *meta = d->relatedMetaObjects[index]; stream << QByteArray(meta->className()); } +#endif // Add an extra empty QByteArray for additional data in future versions. // This should help maintain backwards compatibility, allowing older @@ -1764,6 +1790,9 @@ void QMetaObjectBuilder::deserialize } // Read the related meta objects. +#ifdef Q_NO_DATA_RELOCATION + //### What do we do here +#else for (index = 0; index < relatedMetaObjectCount; ++index) { if (stream.status() != QDataStream::Ok) return; @@ -1775,6 +1804,7 @@ void QMetaObjectBuilder::deserialize } addRelatedMetaObject(cl); } +#endif // Read the extra data block, which is reserved for future use. stream >> name; diff --git a/src/declarative/qml/qmetaobjectbuilder_p.h b/src/declarative/qml/qmetaobjectbuilder_p.h index c0b7426..fc26c11 100644 --- a/src/declarative/qml/qmetaobjectbuilder_p.h +++ b/src/declarative/qml/qmetaobjectbuilder_p.h @@ -135,7 +135,11 @@ public: int addClassInfo(const QByteArray& name, const QByteArray& value); +#ifdef Q_NO_DATA_RELOCATION + int addRelatedMetaObject(const QMetaObjectAccessor &meta); +#else int addRelatedMetaObject(const QMetaObject *meta); +#endif void addMetaObject(const QMetaObject *prototype, QMetaObjectBuilder::AddMembers members = AllMembers); @@ -180,7 +184,7 @@ public: #endif private: - Q_DISABLE_COPY(QMetaObjectBuilder); + Q_DISABLE_COPY(QMetaObjectBuilder) QMetaObjectBuilderPrivate *d; diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index c0dd1a8..1aa2cb9 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -652,7 +652,8 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre } QmlDeclarativeData::QmlDeclarativeData(QmlContext *ctxt) -: context(ctxt), bindings(0), deferredComponent(0), attachedProperties(0) +: context(ctxt), bindings(0), outerContext(0), lineNumber(0), columnNumber(0), deferredComponent(0), + deferredIdx(0), attachedProperties(0) { } diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp index e47b4ab..bae1682 100644 --- a/src/declarative/qml/qmlinfo.cpp +++ b/src/declarative/qml/qmlinfo.cpp @@ -85,7 +85,11 @@ QmlInfo::QmlInfo(QObject *object) QmlDeclarativeData *ddata = QmlDeclarativeData::get(object); if (ddata) { QString location = QLatin1String("("); - location += ddata->outerContext->baseUrl().toString(); + if (ddata->outerContext) { + location += ddata->outerContext->baseUrl().toString(); + } else { + location += "unknown"; + } location += QLatin1String(":"); location += QString::number(ddata->lineNumber); location += QLatin1String(":"); diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index b305619..792b098 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -721,7 +721,8 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value) int vt = value.userType(); int category = propertyCategory(); - if (vt == t) { + if (vt == t + && t != QVariant::Url) { // always resolve relative urls void *a[1]; a[0] = (void *)value.constData(); @@ -877,7 +878,10 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value) case QVariant::Url: { QUrl u; - if (vt == QVariant::ByteArray) { + if (vt == QVariant::Url) { + u = value.toUrl(); + found = true; + } else if (vt == QVariant::ByteArray) { u = QUrl(QLatin1String(value.toByteArray())); found = true; } else if (vt == QVariant::String) { |