diff --git a/include/GFModuleCommonUtils.hpp b/include/GFModuleCommonUtils.hpp index af2ba4d..1d23d2d 100644 --- a/include/GFModuleCommonUtils.hpp +++ b/include/GFModuleCommonUtils.hpp @@ -216,7 +216,7 @@ inline auto ConvertMapToParams(const QMap& param_map) -> GFModuleEventParam* { GFModuleEventParam* head = nullptr; GFModuleEventParam* prev = nullptr; - +#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) for (const auto& [key, value] : param_map.asKeyValueRange()) { auto* param = static_cast( GFAllocateMemory(sizeof(GFModuleEventParam))); @@ -232,6 +232,24 @@ inline auto ConvertMapToParams(const QMap& param_map) } prev = param; } +#else + for (auto it = param_map.keyValueBegin(); it != param_map.keyValueEnd(); + ++it) { + auto* param = static_cast( + GFAllocateMemory(sizeof(GFModuleEventParam))); + + param->name = DUP(it->first.toUtf8()); + param->value = DUP(it->second.toUtf8()); + param->next = nullptr; + + if (prev == nullptr) { + head = param; + } else { + prev->next = param; + } + prev = param; + } +#endif return head; }