From 9f41f6ee72fd63c62f68446beef10d37a957e35a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 16 Jan 2020 09:22:28 +0100 Subject: compat/qhash: try fix older Qt --- compat/qhash.hpp | 20 ++++++++++++++++++++ dinput/win32-joystick.hpp | 2 +- options/connector.hpp | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 compat/qhash.hpp 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 +#include +#include + +// Qt < 5.14.0 +#ifndef QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF + +namespace std { +template<> struct hash +{ + 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 #include -#include +#include "compat/qhash.hpp" #include #include 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 #include -#include +#include "compat/qhash.hpp" #include "export.hpp" -- cgit v1.2.3