summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qabstractitemmodel.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-12-03 09:04:07 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-12-03 15:46:43 +0000
commit2f747bb57cd958f9fc65f406474c429ca00941ac (patch)
tree68961160243879b8a0280ef8093a32c8f6dbe53a /src/corelib/itemmodels/qabstractitemmodel.h
parentfaaf8f5c0a73a27a159f00027ebeba5d486be6a9 (diff)
Fix hashing of QPersistentModelIndex
The hash and equality operators used need to be consistent with each other. Unfortunately, QPMI::operator==() is not suitable to do this. So specialize qHashEquals() for QPMI. Fixes: QTBUG-88966 Change-Id: If5f19a722ae9fc4e78e93537e7ea15726f148768 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 83e95956ed58e88b11e2cc3cb61c5beacb7985db) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/itemmodels/qabstractitemmodel.h')
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index 5d4ac59966..8340ca0e73 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -242,6 +242,8 @@ public:
private:
QPersistentModelIndexData *d;
friend size_t qHash(const QPersistentModelIndex &, size_t seed) noexcept;
+ friend bool qHashEquals(const QPersistentModelIndex &a, const QPersistentModelIndex &b) noexcept
+ { return a.d == b.d; }
#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &);
#endif