aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/util')
-rw-r--r--src/qml/util/qqmlpropertymap.cpp16
-rw-r--r--src/qml/util/qqmlpropertymap.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/src/qml/util/qqmlpropertymap.cpp b/src/qml/util/qqmlpropertymap.cpp
index e38cf3a2a9..2bf8ab0190 100644
--- a/src/qml/util/qqmlpropertymap.cpp
+++ b/src/qml/util/qqmlpropertymap.cpp
@@ -204,6 +204,22 @@ void QQmlPropertyMap::clear(const QString &key)
}
/*!
+ \since 6.1
+
+ Disallows any further properties to be added to this property map.
+ Existing properties can be modified or cleared.
+
+ In turn, an internal cache is turned on for the existing properties, which
+ may result in faster access from QML.
+ */
+void QQmlPropertyMap::freeze()
+{
+ Q_D(QQmlPropertyMap);
+ d->mo->setAutoCreatesProperties(false);
+ d->mo->setCached(true);
+}
+
+/*!
Returns the value associated with \a key.
If no value has been set for this key (or if the value has been cleared),
diff --git a/src/qml/util/qqmlpropertymap.h b/src/qml/util/qqmlpropertymap.h
index 556754c021..de070673d7 100644
--- a/src/qml/util/qqmlpropertymap.h
+++ b/src/qml/util/qqmlpropertymap.h
@@ -62,6 +62,7 @@ public:
void insert(const QString &key, const QVariant &value);
void insert(const QVariantHash &values);
void clear(const QString &key);
+ void freeze();
Q_INVOKABLE QStringList keys() const;