From 5132709440d9161aae5893341d9180137f1181d7 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 8 May 2018 15:52:34 +0200 Subject: Clean up QQmlOpenMetaObject property data structure Use a vector instead of a list for a more compact storage - random access is a more frequent operation than appending/removal. Also use a struct instead of a QPair for increased readability of the code and encapsulate read and write operations. Clean up the internal API to avoid unnecessary mutable property extraction. This also helps to ensure that in all cases but intended mutation we end up using the property getter that returns a QVariant by value, something that will allow returning a null variant when QObject tracking gets fixed in the next patch. Change-Id: I563a930fe959b7636f9e9dc88a28cdcefc196707 Reviewed-by: Lars Knoll --- src/qml/util/qqmlpropertymap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qml/util') diff --git a/src/qml/util/qqmlpropertymap.cpp b/src/qml/util/qqmlpropertymap.cpp index 578c05086f..3f78ca6b69 100644 --- a/src/qml/util/qqmlpropertymap.cpp +++ b/src/qml/util/qqmlpropertymap.cpp @@ -122,7 +122,7 @@ QVariant QQmlPropertyMapMetaObject::propertyWriteValue(int index, const QVariant void QQmlPropertyMapMetaObject::propertyWritten(int index) { - priv->emitChanged(priv->propertyName(index), operator[](index)); + priv->emitChanged(priv->propertyName(index), value(index)); } void QQmlPropertyMapMetaObject::propertyCreated(int, QMetaPropertyBuilder &b) @@ -311,7 +311,7 @@ QVariant &QQmlPropertyMap::operator[](const QString &key) if (!d->keys.contains(key)) insert(key, QVariant());//force creation -- needed below - return (*(d->mo))[utf8key]; + return d->mo->valueRef(utf8key); } /*! -- cgit v1.2.3