diff options
-rw-r--r-- | compat/qhash.hpp | 20 | ||||
-rw-r--r-- | dinput/win32-joystick.hpp | 2 | ||||
-rw-r--r-- | options/connector.hpp | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/compat/qhash.hpp b/compat/qhash.hpp new file mode 100644 index 00000000..507b612e --- /dev/null +++ b/compat/qhash.hpp @@ -0,0 +1,20 @@ +#pragma once + +#include <QtGlobal> +#include <QString> +#include <QHashFunctions> + +// Qt < 5.14.0 +#ifndef QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF + +namespace std { +template<> struct hash<QString> +{ + unsigned operator()(const QString& value) const + { + return qHash(value); + } +}; +} + +#endif diff --git a/dinput/win32-joystick.hpp b/dinput/win32-joystick.hpp index e0721bdf..ff52ad1d 100644 --- a/dinput/win32-joystick.hpp +++ b/dinput/win32-joystick.hpp @@ -17,7 +17,7 @@ #include <unordered_map> #include <iterator> -#include <QHashFunctions> +#include "compat/qhash.hpp" #include <QString> #include <QMutex> diff --git a/options/connector.hpp b/options/connector.hpp index ffef2a3d..d32f896f 100644 --- a/options/connector.hpp +++ b/options/connector.hpp @@ -13,7 +13,7 @@ #include <QString> #include <QMutex> -#include <QHashFunctions> +#include "compat/qhash.hpp" #include "export.hpp" |