1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 13:41:16 +01:00

Use propper qHash return values on Qt6

This commit is contained in:
Martin Tůma 2021-01-10 13:23:43 +01:00
parent 7a664342b6
commit 815071fc55
6 changed files with 23 additions and 11 deletions

View File

@ -1,6 +1,8 @@
#ifndef SEARCHPOINTER_H #ifndef SEARCHPOINTER_H
#define SEARCHPOINTER_H #define SEARCHPOINTER_H
#include "common/config.h"
template <class T> template <class T>
class SearchPointer class SearchPointer
{ {
@ -16,7 +18,7 @@ private:
}; };
template <class T> template <class T>
inline uint qHash(const SearchPointer<T> &t) inline HASH_T qHash(const SearchPointer<T> &t)
{ {
return ::qHash(*(t.data())); return ::qHash(*(t.data()));
} }

View File

@ -6,4 +6,10 @@
#define APP_NAME "GPXSee" #define APP_NAME "GPXSee"
#define APP_HOMEPAGE "http://www.gpxsee.org" #define APP_HOMEPAGE "http://www.gpxsee.org"
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#define HASH_T uint
#else // QT6
#define HASH_T size_t
#endif // QT6
#endif /* CONFIG_H */ #endif /* CONFIG_H */

View File

@ -4,6 +4,7 @@
#include <QString> #include <QString>
#include <QCache> #include <QCache>
#include <QByteArray> #include <QByteArray>
#include "common/config.h"
class QString; class QString;
class Coordinates; class Coordinates;
@ -37,12 +38,12 @@ public:
static void setDir(const QString &path); static void setDir(const QString &path);
static qreal elevation(const Coordinates &c); static qreal elevation(const Coordinates &c);
friend uint qHash(const Key &key); friend HASH_T qHash(const Key &key);
}; };
inline uint qHash(const DEM::Key &key) inline HASH_T qHash(const DEM::Key &key)
{ {
return (key.lon() ^ key.lat()); return (qHash(key.lon()) ^ qHash(key.lat()));
} }
#endif // DEM_H #endif // DEM_H

View File

@ -6,6 +6,7 @@
#include <QHash> #include <QHash>
#include <QVector> #include <QVector>
#include <QDebug> #include <QDebug>
#include "common/config.h"
#include "common/coordinates.h" #include "common/coordinates.h"
#include "imageinfo.h" #include "imageinfo.h"
#include "link.h" #include "link.h"
@ -68,7 +69,7 @@ private:
static bool _show2ndElevation; static bool _show2ndElevation;
}; };
inline uint qHash(const Waypoint &key) inline HASH_T qHash(const Waypoint &key)
{ {
return ::qHash(key.name()); return ::qHash(key.name());
} }

View File

@ -3,6 +3,7 @@
#include <QString> #include <QString>
#include <QDebug> #include <QDebug>
#include "common/config.h"
#define FIRST_SHIELD Label::Shield::USInterstate #define FIRST_SHIELD Label::Shield::USInterstate
#define LAST_SHIELD Label::Shield::Oval #define LAST_SHIELD Label::Shield::Oval
@ -52,9 +53,9 @@ private:
Shield _shield; Shield _shield;
}; };
inline uint qHash(const Label::Shield &shield) inline HASH_T qHash(const Label::Shield &shield)
{ {
return qHash(shield.text()) ^ shield.type(); return qHash(shield.text()) ^ qHash(shield.type());
} }
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG

View File

@ -6,6 +6,7 @@
#include <QSet> #include <QSet>
#include <QList> #include <QList>
#include <QHash> #include <QHash>
#include "common/config.h"
#include "common/rectc.h" #include "common/rectc.h"
#include "common/kv.h" #include "common/kv.h"
#include "projection.h" #include "projection.h"
@ -169,16 +170,16 @@ private:
bool _valid, _ready; bool _valid, _ready;
QString _errorString; QString _errorString;
friend uint qHash(const WMTS::TileMatrix &key); friend HASH_T qHash(const WMTS::TileMatrix &key);
friend uint qHash(const WMTS::MatrixLimits &key); friend HASH_T qHash(const WMTS::MatrixLimits &key);
}; };
inline uint qHash(const WMTS::TileMatrix &key) inline HASH_T qHash(const WMTS::TileMatrix &key)
{ {
return ::qHash(key.id); return ::qHash(key.id);
} }
inline uint qHash(const WMTS::MatrixLimits &key) inline HASH_T qHash(const WMTS::MatrixLimits &key)
{ {
return ::qHash(key.id); return ::qHash(key.id);
} }