diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-11 12:00:46 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-11 12:00:46 (GMT) |
commit | 3e8791f60bdba5966054f025312d55756f0a17d3 (patch) | |
tree | b471a8f2efdba25304c2862ede01db5e701d0f08 | |
parent | 835a23891567831cf184e5bbaba8d00bfc912699 (diff) | |
download | Qt-3e8791f60bdba5966054f025312d55756f0a17d3.zip Qt-3e8791f60bdba5966054f025312d55756f0a17d3.tar.gz Qt-3e8791f60bdba5966054f025312d55756f0a17d3.tar.bz2 |
Fixup qmllanguage::aliasProperties test
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 5 | ||||
-rw-r--r-- | src/declarative/qml/qmlvmemetaobject.cpp | 11 | ||||
-rw-r--r-- | src/declarative/qml/qmlvmemetaobject_p.h | 3 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 8e92eb4..81ebd86 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -2340,6 +2340,7 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder, QByteArray typeName; int propIdx = -1; + int flags = 0; bool writable = false; if (alias.count() == 2) { propIdx = idObject->metaObject()->indexOfProperty(alias.at(1).toUtf8().constData()); @@ -2359,8 +2360,12 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder, typeName += "*"; } + if (typeName.endsWith('*')) + flags |= QML_ALIAS_FLAG_PTR; + data.append((const char *)&idObject->idIndex, sizeof(idObject->idIndex)); data.append((const char *)&propIdx, sizeof(propIdx)); + data.append((const char *)&flags, sizeof(flags)); builder.addSignal(prop.name + "Changed()"); QMetaPropertyBuilder propBuilder = diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp index 5315089..ed28d78 100644 --- a/src/declarative/qml/qmlvmemetaobject.cpp +++ b/src/declarative/qml/qmlvmemetaobject.cpp @@ -210,17 +210,18 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) if (id < metaData->aliasCount) { - if (!ctxt) return -1; QmlVMEMetaData::AliasData *d = metaData->aliasData() + id; + + if (d->flags & QML_ALIAS_FLAG_PTR && c == QMetaObject::ReadProperty) + *reinterpret_cast<void **>(a[0]) = 0; + + if (!ctxt) return -1; QmlContextPrivate *ctxtPriv = (QmlContextPrivate *)QObjectPrivate::get(ctxt); QObject *target = ctxtPriv->idValues[d->contextIdx].data(); - if (!target) { - if (d->propertyIdx == -1) - *reinterpret_cast<QObject **>(a[0]) = target; + if (!target) return -1; - } if (c == QMetaObject::ReadProperty && !aConnected.testBit(id)) { int sigIdx = methodOffset + id + metaData->propertyCount; diff --git a/src/declarative/qml/qmlvmemetaobject_p.h b/src/declarative/qml/qmlvmemetaobject_p.h index 9262b19..f2ee09b 100644 --- a/src/declarative/qml/qmlvmemetaobject_p.h +++ b/src/declarative/qml/qmlvmemetaobject_p.h @@ -61,6 +61,8 @@ QT_BEGIN_NAMESPACE +#define QML_ALIAS_FLAG_PTR 0x00000001 + struct QmlVMEMetaData { short propertyCount; @@ -71,6 +73,7 @@ struct QmlVMEMetaData struct AliasData { int contextIdx; int propertyIdx; + int flags; }; struct PropertyData { |