diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-13 11:50:07 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-13 14:32:11 +0100 |
commit | b64f8dacae36fca948933cf56498d5e4ad3e2a07 (patch) | |
tree | 3c41c0270d6b4ab13b104581b0f1024e0e3cddab /src/qml/qml/qqmlopenmetaobject_p.h | |
parent | 315261a809778a8ac37c523741e021d6431ab85e (diff) |
QQmlPropertyMap: Add a method to insert multiple values at once
This avoid re-building the metaobject for every property added. As
rebuilding the metaobject is an effort linear in the number of
properties, the runtime when adding multiple properties via singular
insert() is quadratic in the number of properties. The plural insert()
rebuilds the metaobject only once.
Task-number: QTBUG-57792
Change-Id: I9513c4de047724e4141dab72aacfbdd840a3e465
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlopenmetaobject_p.h')
-rw-r--r-- | src/qml/qml/qqmlopenmetaobject_p.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlopenmetaobject_p.h b/src/qml/qml/qqmlopenmetaobject_p.h index 168a2a6f7f..441556a079 100644 --- a/src/qml/qml/qqmlopenmetaobject_p.h +++ b/src/qml/qml/qqmlopenmetaobject_p.h @@ -101,6 +101,7 @@ public: QVariant value(const QByteArray &) const; bool setValue(const QByteArray &, const QVariant &, bool force = false); + void setValues(const QHash<QByteArray, QVariant> &, bool force = false); QVariant value(int) const; void setValue(int, const QVariant &); QVariant &valueRef(const QByteArray &); @@ -132,6 +133,8 @@ protected: QAbstractDynamicMetaObject *parent() const; + bool checkedSetValue(int index, const QVariant &value, bool force); + private: QQmlOpenMetaObjectPrivate *d; friend class QQmlOpenMetaObjectType; |