From 6a3531eef9df83d7f999560f1e380680c61a45cb Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 11 Oct 2023 18:30:20 +0300 Subject: [PATCH] Fix compatibility with Qt 5.6. --- src/libs/vmisc/compatibility.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/libs/vmisc/compatibility.h b/src/libs/vmisc/compatibility.h index c761df6b6..c463e7668 100644 --- a/src/libs/vmisc/compatibility.h +++ b/src/libs/vmisc/compatibility.h @@ -74,6 +74,32 @@ inline bool operator==(const QString &lhs, QChar rhs) Q_DECL_NOEXCEPT } #endif +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) +//--------------------------------------------------------------------------------------------------------------------- +Q_DECL_CONSTEXPR inline bool operator==(QChar c1, char16_t c2) Q_DECL_NOEXCEPT +{ + return c1 == QChar(static_cast(c2)); +} + +//--------------------------------------------------------------------------------------------------------------------- +Q_DECL_CONSTEXPR inline bool operator!=(QChar c1, char16_t c2) Q_DECL_NOEXCEPT +{ + return !(c1 == QChar(static_cast(c2))); +} + +//--------------------------------------------------------------------------------------------------------------------- +Q_DECL_CONSTEXPR inline bool operator==(char16_t c1, QChar c2) Q_DECL_NOEXCEPT +{ + return c2 == c1; +} + +//--------------------------------------------------------------------------------------------------------------------- +Q_DECL_CONSTEXPR inline bool operator!=(char16_t c1, QChar c2) Q_DECL_NOEXCEPT +{ + return c2 != c1; +} +#endif + #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) namespace Qt {