From f769f179c816a244f91dba359ad9e0a3eb234e0a Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sat, 1 Feb 2020 23:55:18 +0000 Subject: [PATCH 1/2] Remove std::hash specialization for Qt >= 5.14 --- qt_helpers.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qt_helpers.hpp b/qt_helpers.hpp index b2ec7a49f..cf86f585b 100644 --- a/qt_helpers.hpp +++ b/qt_helpers.hpp @@ -78,6 +78,12 @@ public: } }; +#if QT_VERSION < QT_VERSION_CHECK (5, 14, 0) +// The Qt devs "fixed" this in 5.14 to specialize to use their own +// qHash(), it doesn't fix the problem we were addressing as qHash() +// returns a uint so is still a poorly distributed 32-bit value on +// 64-bit platforms, but we can't specialize ourselves as Qt already +// has - sigh. namespace std { // std::hash<> specialization for QString based on the dbj2 @@ -97,6 +103,7 @@ namespace std } }; } +#endif // Register some useful Qt types with QMetaType Q_DECLARE_METATYPE (QHostAddress); From 68893d4fe975bbd5cd6eb4242e3f21988bdcbd85 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sat, 1 Feb 2020 23:56:35 +0000 Subject: [PATCH 2/2] Tidy formatting --- qt_helpers.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qt_helpers.hpp b/qt_helpers.hpp index cf86f585b..04e082e66 100644 --- a/qt_helpers.hpp +++ b/qt_helpers.hpp @@ -31,12 +31,12 @@ auto const& me = mo.enumerator (mo.indexOfEnumerator (#ENUM)); \ if (buffer) \ { \ - v = static_cast (me.keyToValue (buffer, &ok)); \ - delete [] buffer; \ + v = static_cast (me.keyToValue (buffer, &ok)); \ + delete [] buffer; \ } \ if (!ok) \ { \ - v = static_cast (me.value (0)); \ + v = static_cast (me.value (0)); \ } \ return is; \ }