diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-03 05:31:58 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-03 05:31:58 (GMT) |
commit | b7702b2dcbc36f81759dea0ad74fb19e97b2358f (patch) | |
tree | 84aad593a6beb229fc4ef106484557e434f81047 /src/declarative/util/qdeclarativeopenmetaobject.cpp | |
parent | cf5d8a23241c31d8a49c78ffb1e3f6ae288eb585 (diff) | |
download | Qt-b7702b2dcbc36f81759dea0ad74fb19e97b2358f.zip Qt-b7702b2dcbc36f81759dea0ad74fb19e97b2358f.tar.gz Qt-b7702b2dcbc36f81759dea0ad74fb19e97b2358f.tar.bz2 |
Ensure dataChanged doesn't force request for unwanted data in QML views.
If a model emits dataChanged() every role was be updated, rather than
just the roles required. Now only roles which have been used are updated.
Task-number: QTBUG-12598
Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative/util/qdeclarativeopenmetaobject.cpp')
-rw-r--r-- | src/declarative/util/qdeclarativeopenmetaobject.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/declarative/util/qdeclarativeopenmetaobject.cpp b/src/declarative/util/qdeclarativeopenmetaobject.cpp index ba5d534..40485bd 100644 --- a/src/declarative/util/qdeclarativeopenmetaobject.cpp +++ b/src/declarative/util/qdeclarativeopenmetaobject.cpp @@ -161,6 +161,12 @@ public: prop.second = true; } + inline bool hasData(int idx) const { + if (idx >= data.count()) + return false; + return data[idx].second; + } + bool autoCreate; QDeclarativeOpenMetaObject *q; QAbstractDynamicMetaObject *parent; @@ -295,6 +301,12 @@ void QDeclarativeOpenMetaObject::setValue(const QByteArray &name, const QVariant activate(d->object, id + d->type->d->signalOffset, 0); } +// returns true if this value has been initialized by a call to either value() or setValue() +bool QDeclarativeOpenMetaObject::hasValue(int id) const +{ + return d->hasData(id); +} + void QDeclarativeOpenMetaObject::setCached(bool c) { if (c == d->cacheProperties || !d->type->d->engine) |