diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-03-29 03:57:41 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-03-29 03:57:41 (GMT) |
commit | da587063eab13e238002aebb05908cd420425c36 (patch) | |
tree | 52e422e3304f7ed5c93d2a53c5636aab51cf203e /src/declarative/util | |
parent | dd81331989b2f6487c6c28e04afc56bd98254322 (diff) | |
parent | e011539844e6702e02770362a95d9b969643a9df (diff) | |
download | Qt-da587063eab13e238002aebb05908cd420425c36.zip Qt-da587063eab13e238002aebb05908cd420425c36.tar.gz Qt-da587063eab13e238002aebb05908cd420425c36.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qdeclarativeopenmetaobject.cpp | 2 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativepropertymap.cpp | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/declarative/util/qdeclarativeopenmetaobject.cpp b/src/declarative/util/qdeclarativeopenmetaobject.cpp index 70ecf95..6611885 100644 --- a/src/declarative/util/qdeclarativeopenmetaobject.cpp +++ b/src/declarative/util/qdeclarativeopenmetaobject.cpp @@ -222,7 +222,7 @@ int QDeclarativeOpenMetaObject::metaCall(QMetaObject::Call c, int id, void **a) propertyRead(propId); *reinterpret_cast<QVariant *>(a[0]) = d->getData(propId); } else if (c == QMetaObject::WriteProperty) { - if (d->data[propId].first != *reinterpret_cast<QVariant *>(a[0])) { + if (propId <= d->data.count() || d->data[propId].first != *reinterpret_cast<QVariant *>(a[0])) { propertyWrite(propId); d->writeData(propId, *reinterpret_cast<QVariant *>(a[0])); propertyWritten(propId); diff --git a/src/declarative/util/qdeclarativepropertymap.cpp b/src/declarative/util/qdeclarativepropertymap.cpp index d3e1d7c..0bdd91b 100644 --- a/src/declarative/util/qdeclarativepropertymap.cpp +++ b/src/declarative/util/qdeclarativepropertymap.cpp @@ -41,6 +41,7 @@ #include "qdeclarativepropertymap.h" +#include <private/qmetaobjectbuilder_p.h> #include "qdeclarativeopenmetaobject_p.h" #include <QDebug> @@ -56,6 +57,7 @@ public: protected: virtual void propertyWritten(int index); + virtual void propertyCreated(int, QMetaPropertyBuilder &); private: QDeclarativePropertyMap *map; @@ -88,6 +90,11 @@ void QDeclarativePropertyMapMetaObject::propertyWritten(int index) priv->emitChanged(QString::fromUtf8(name(index)), operator[](index)); } +void QDeclarativePropertyMapMetaObject::propertyCreated(int, QMetaPropertyBuilder &b) +{ + priv->keys.append(QString::fromUtf8(b.name())); +} + /*! \class QDeclarativePropertyMap \since 4.7 @@ -172,8 +179,6 @@ QVariant QDeclarativePropertyMap::value(const QString &key) const void QDeclarativePropertyMap::insert(const QString &key, const QVariant &value) { Q_D(QDeclarativePropertyMap); - if (!d->keys.contains(key)) - d->keys.append(key); d->mo->setValue(key.toUtf8(), value); } @@ -249,10 +254,8 @@ QVariant &QDeclarativePropertyMap::operator[](const QString &key) //### optimize Q_D(QDeclarativePropertyMap); QByteArray utf8key = key.toUtf8(); - if (!d->keys.contains(key)) { - d->keys.append(key); + if (!d->keys.contains(key)) d->mo->setValue(utf8key, QVariant()); //force creation -- needed below - } return (*(d->mo))[utf8key]; } |