summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2020-01-16 09:22:28 +0100
committerStanislaw Halik <sthalik@misaki.pl>2020-01-16 09:22:28 +0100
commit9f41f6ee72fd63c62f68446beef10d37a957e35a (patch)
treea74b87256c2d284bb9a2061fa323bf36f44b991e
parent901e06488ae89ff57362a0be534a45eccccbf67a (diff)
compat/qhash: try fix older Qt
-rw-r--r--compat/qhash.hpp20
-rw-r--r--dinput/win32-joystick.hpp2
-rw-r--r--options/connector.hpp2
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"