aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlengine_p.h
diff options
context:
space:
mode:
authorVladimir Belyavsky <belyavskyv@gmail.com>2024-04-22 18:16:24 +0300
committerVladimir Belyavsky <belyavskyv@gmail.com>2024-04-22 20:26:47 +0000
commit19b09affee8698f80d386e3b286753974f6bf10a (patch)
tree9e4d147a36ba22308ad397b455f29478edbe032e /src/qml/qml/qqmlengine_p.h
parent7b463868de47c5f08f086e9508cb4b41a310f268 (diff)
QtQml: Use QHash/QMap's constFind() to avoid unnecessary detaches
Use QHash/QMap's constFind() instead of non-const find() where applicable to avoid unnecessary detaches. Change-Id: I6b31af1d163d11deb229681ff7e2f6c9f8335d8c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlengine_p.h')
-rw-r--r--src/qml/qml/qqmlengine_p.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h
index 4b38db9ec9..7c820679ba 100644
--- a/src/qml/qml/qqmlengine_p.h
+++ b/src/qml/qml/qqmlengine_p.h
@@ -207,8 +207,8 @@ public:
QQmlGadgetPtrWrapper *valueTypeInstance(QMetaType type)
{
int typeIndex = type.id();
- auto it = cachedValueTypeInstances.find(typeIndex);
- if (it != cachedValueTypeInstances.end())
+ auto it = cachedValueTypeInstances.constFind(typeIndex);
+ if (it != cachedValueTypeInstances.cend())
return *it;
if (QQmlValueType *valueType = QQmlMetaType::valueType(type)) {