From 7d8dd28668193880728b73a470d7889d30feb7a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Poizl?= Date: Thu, 26 Jan 2023 14:04:04 +0100 Subject: [PATCH] Fix compilation on older Qt --- libxisf.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libxisf.cpp b/libxisf.cpp index b55a4ad..399b7c4 100644 --- a/libxisf.cpp +++ b/libxisf.cpp @@ -12,6 +12,14 @@ #define STRING_ENUM(e) {#e, e} +template<> struct std::hash +{ + size_t operator()(const QString &string) const + { + return std::hash{}(string.toStdString()); + } +}; + namespace LibXISF { @@ -677,9 +685,8 @@ void XISFWriter::writeMetadata() _xml->writeEndElement(); } -#define REGISTER_METATYPE(type) qRegisterMetaType("LibXISF::"#type); \ - typeToId.insert({#type, QMetaType::fromType().id()}); \ - idToType.insert({QMetaType::fromType().id(), #type}) +#define REGISTER_METATYPE(type) { int id = qRegisterMetaType("LibXISF::"#type); \ + typeToId.insert({#type, id}); idToType.insert({id, #type}); } struct TypesInit {