Fixing compatibility with Qt 5.6.

This commit is contained in:
Roman Telezhynskyi 2023-10-09 13:40:55 +03:00
parent d913a3bd0d
commit b40d8e3c8e

View File

@ -54,6 +54,26 @@
class QPointF;
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
//---------------------------------------------------------------------------------------------------------------------
inline bool operator==(QChar lhs, const QString &rhs) Q_DECL_NOEXCEPT
{
return rhs.size() == 1 && lhs == rhs[0];
}
//---------------------------------------------------------------------------------------------------------------------
inline bool operator!=(QChar lhs, const QString &rhs) Q_DECL_NOEXCEPT
{
return !(lhs == rhs);
}
//---------------------------------------------------------------------------------------------------------------------
inline bool operator==(const QString &lhs, QChar rhs) Q_DECL_NOEXCEPT
{
return rhs == lhs;
}
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
namespace Qt
{
@ -63,25 +83,25 @@ inline namespace StringLiterals
{
//---------------------------------------------------------------------------------------------------------------------
constexpr inline auto operator"" _L1(char ch) noexcept -> QLatin1Char
Q_DECL_CONSTEXPR inline auto operator"" _L1(char ch) Q_DECL_NOEXCEPT->QLatin1Char
{
return QLatin1Char(ch);
}
//---------------------------------------------------------------------------------------------------------------------
constexpr inline auto operator"" _L1(const char *str, size_t size) noexcept -> QLatin1String
Q_DECL_CONSTEXPR inline auto operator"" _L1(const char *str, size_t size) Q_DECL_NOEXCEPT->QLatin1String
{
return QLatin1String(str, static_cast<vsizetype>(size));
}
//---------------------------------------------------------------------------------------------------------------------
inline auto operator"" _ba(const char *str, size_t size) noexcept -> QByteArray
inline auto operator"" _ba(const char *str, size_t size) Q_DECL_NOEXCEPT->QByteArray
{
return {str, static_cast<vsizetype>(size)};
}
//---------------------------------------------------------------------------------------------------------------------
inline auto operator"" _s(const char16_t *str, size_t size) noexcept -> QString
inline auto operator"" _s(const char16_t *str, size_t size) Q_DECL_NOEXCEPT->QString
{
return QString::fromUtf16(str, static_cast<vsizetype>(size));
}