diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2012-07-02 09:01:56 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-23 19:57:07 +0200 |
commit | 58ec01e278496bdaaee05546beb543a119de4277 (patch) | |
tree | 7a4437101eb0acaff913ad4696626b2b8cfa149d /src/corelib/itemmodels | |
parent | acbfb4d777474aadd28136141082a8114d4310ac (diff) |
More qHash(T, uint) support
Add the seed to QPair, QUuid, QPersistentModelIndex's qHash(), and fix
qHash documentation for them and for many other datatypes.
Change-Id: I1386f3ed42ee1a832371a242ee5c82895ba92c2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/itemmodels')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 10 | ||||
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.h | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 9e0e9c06de..87bcb6dfdc 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -3517,11 +3517,13 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti */ /*! - \fn uint qHash(const QPersistentModelIndex &index) - \since 4.5 + \fn uint qHash(const QPersistentModelIndex &index, uint seed = 0) + \since 5.0 + \relates QPersistentModelIndex - Returns a hash of the QPersistentModelIndex - */ + Returns a hash of the QPersistentModelIndex \a index, using \a seed to + seed the calculation. +*/ /*! diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index 66af606dac..4cdafdd9d8 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.h +++ b/src/corelib/itemmodels/qabstractitemmodel.h @@ -134,15 +134,15 @@ public: bool isValid() const; private: QPersistentModelIndexData *d; - friend uint qHash(const QPersistentModelIndex &); + friend uint qHash(const QPersistentModelIndex &, uint seed = 0); #ifndef QT_NO_DEBUG_STREAM friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &); #endif }; Q_DECLARE_SHARED(QPersistentModelIndex) -inline uint qHash(const QPersistentModelIndex &index) -{ return qHash(index.d); } +inline uint qHash(const QPersistentModelIndex &index, uint seed) +{ return qHash(index.d, seed); } #ifndef QT_NO_DEBUG_STREAM |