diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2020-09-07 15:57:15 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2020-09-15 02:46:40 +0200 |
commit | fb65b32d7621f065ec854f1e72828720bffb3b39 (patch) | |
tree | 7f8bc479ddc552a654f91d998d701f1bbf496d76 /src/corelib/tools | |
parent | 9815ebf24b5aa148a416ee3b159088f0092d2715 (diff) |
Add qHash implementation for QPoint
[ChangeLog][QtCore][QPoint] Added qHash() implementation.
Change-Id: I65332e7aafab53af40a6e11457b9b457196d584c
Fixes: QTBUG-86457
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qpoint.cpp | 14 | ||||
-rw-r--r-- | src/corelib/tools/qpoint.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp index 432fb33297..eca1b5a0ac 100644 --- a/src/corelib/tools/qpoint.cpp +++ b/src/corelib/tools/qpoint.cpp @@ -41,6 +41,7 @@ #include "qdatastream.h" #include <private/qdebug_p.h> +#include <QtCore/qhashfunctions.h> QT_BEGIN_NAMESPACE @@ -484,6 +485,19 @@ QDebug operator<<(QDebug dbg, const QPointF &p) #endif /*! + \fn size_t qHash(QPoint key, size_t seed = 0) + \relates QHash + \since 6.0 + + Returns the hash value for the \a key, using \a seed to seed the + calculation. +*/ +size_t qHash(QPoint key, size_t seed) noexcept +{ + return qHashMulti(seed, key.x(), key.y()); +} + +/*! \class QPointF \inmodule QtCore \ingroup painting diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h index 725787265f..e854e77198 100644 --- a/src/corelib/tools/qpoint.h +++ b/src/corelib/tools/qpoint.h @@ -214,6 +214,7 @@ constexpr inline const QPoint operator/(const QPoint &p, qreal c) Q_CORE_EXPORT QDebug operator<<(QDebug, const QPoint &); #endif +Q_CORE_EXPORT size_t qHash(QPoint key, size_t seed = 0) noexcept; |