qHash: Add seed argument for classes inheriting QString

Pre-requisite for a fix for qHash. The classes inherits from QString
and after the upcoming fix their single-arg qHash overload is no longer
preferred since we want to use a seed. This has been the case since
Qt 5.

Pick-to: 6.2 6.4
Change-Id: I6e8601ab8d591742e2399d10521dec8cfa46f71a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Mårten Nordheim 2022-09-27 20:40:22 +02:00
parent 6a581bc89e
commit a6e8ee141d
2 changed files with 8 additions and 2 deletions

View File

@ -104,7 +104,10 @@ public:
Q_DECLARE_TYPEINFO(QFileSystemWatcherPathKey, Q_RELOCATABLE_TYPE);
inline size_t qHash(const QFileSystemWatcherPathKey &key) { return qHash(key.toCaseFolded()); }
inline size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed = 0)
{
return qHash(key.toCaseFolded(), seed);
}
class QWindowsFileSystemWatcherEngineThread : public QThread
{

View File

@ -50,7 +50,10 @@ public:
Q_DECLARE_TYPEINFO(QFileSystemModelNodePathKey, Q_RELOCATABLE_TYPE);
inline size_t qHash(const QFileSystemModelNodePathKey &key) { return qHash(key.toCaseFolded()); }
inline size_t qHash(const QFileSystemModelNodePathKey &key, size_t seed = 0)
{
return qHash(key.toCaseFolded(), seed);
}
#else // Q_OS_WIN
typedef QString QFileSystemModelNodePathKey;
#endif