LSP: Fix building with Qt less than 6.4

Change-Id: I25f8be3a256328443dd42d72d05ce5b6b717bded
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2024-01-09 09:52:58 +01:00
parent 7b32c47494
commit d358589004
2 changed files with 14 additions and 0 deletions

View File

@@ -3,11 +3,21 @@
#pragma once #pragma once
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
#include <QLatin1StringView> #include <QLatin1StringView>
#else
#include <QLatin1String>
#endif
namespace LanguageServerProtocol { namespace LanguageServerProtocol {
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
using Key = QLatin1StringView; using Key = QLatin1StringView;
#else
using Key = QLatin1String;
#endif
constexpr Key actionsKey{"actions"}; constexpr Key actionsKey{"actions"};
constexpr Key activeParameterKey{"activeParameter"}; constexpr Key activeParameterKey{"activeParameter"};

View File

@@ -43,7 +43,11 @@ public:
const_iterator end() const { return m_jsonObject.end(); } const_iterator end() const { return m_jsonObject.end(); }
protected: protected:
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
using Key = QLatin1StringView; using Key = QLatin1StringView;
#else
using Key = QLatin1String;
#endif
iterator insert(const Key key, const JsonObject &value); iterator insert(const Key key, const JsonObject &value);
iterator insert(const Key key, const QJsonValue &value); iterator insert(const Key key, const QJsonValue &value);