summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-12-03 09:04:07 +0100
committerLars Knoll <lars.knoll@qt.io>2020-12-03 13:49:15 +0100
commit83e95956ed58e88b11e2cc3cb61c5beacb7985db (patch)
treedbd796d04c1e93dfd17ab26b74b686e9d5793f33 /src/corelib/itemmodels
parent5d8b586e73e37070b0303bee24372550854637eb (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 Pick-to: 6.0 dev Change-Id: If5f19a722ae9fc4e78e93537e7ea15726f148768 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/itemmodels')
-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