diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2021-07-26 15:19:56 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-27 15:04:52 +0000 |
commit | 31865920e3fe4122403ceadb7178dc226034feb3 (patch) | |
tree | e2fb30d1f1c31e0cdfa5a087683ae01300b48a9a /src/positioning/qgeoshape.cpp | |
parent | 2a5f7d270b58a7ec0ada33df62e4dc64afd3becd (diff) | |
download | qtlocation-31865920e3fe4122403ceadb7178dc226034feb3.tar.gz |
Add qHash overloads to QGeoShape hierarchy
This patch adds qHash overloads to QGeoShape hierarchy, allowing to use
the classes as keys in QHash.
Note that the actual qHash overload is required only for the base type.
All the derived classes are correctly hashed using the virtual method
in private d_ptr.
Task-number: QTBUG-95163
Change-Id: I186f9d396e698187ebf0363d96c19e324db10905
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit cc6d520ee633d15b18724e3b7e6ecff25570dd0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/positioning/qgeoshape.cpp')
-rw-r--r-- | src/positioning/qgeoshape.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/positioning/qgeoshape.cpp b/src/positioning/qgeoshape.cpp index 58df873b..7ab32b60 100644 --- a/src/positioning/qgeoshape.cpp +++ b/src/positioning/qgeoshape.cpp @@ -429,6 +429,21 @@ QDataStream &QGeoShape::dataStreamIn(QDataStream &stream, QGeoShape &shape) } #endif +/*! + \relates QGeoShape + + Returns the hash value for the \a shape, using \a seed for the + calculation. +*/ +size_t qHash(const QGeoShape &shape, size_t seed) noexcept +{ + if (shape.d_ptr) + return shape.d_ptr->hash(seed); + else + return qHashMulti(seed, shape.type()); +} + QT_END_NAMESPACE #include "moc_qgeoshape.cpp" + |