aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/qtcompat.h
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/ApiExtractor/qtcompat.h')
-rw-r--r--sources/shiboken6/ApiExtractor/qtcompat.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/sources/shiboken6/ApiExtractor/qtcompat.h b/sources/shiboken6/ApiExtractor/qtcompat.h
new file mode 100644
index 000000000..3837dcfd2
--- /dev/null
+++ b/sources/shiboken6/ApiExtractor/qtcompat.h
@@ -0,0 +1,37 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#ifndef QTCOMPAT_H
+#define QTCOMPAT_H
+
+#include <QtCore/qtconfigmacros.h>
+
+#if QT_VERSION < 0x060400
+
+// QTBUG-98434, provide literals of Qt 6.4 for compatibility.
+
+# include <QtCore/QString>
+
+# define QLatin1StringView QLatin1String
+
+namespace Qt {
+inline namespace Literals {
+inline namespace StringLiterals {
+
+constexpr inline QLatin1String operator"" _L1(const char *str, size_t size) noexcept
+{
+ return QLatin1String(str, qsizetype(size));
+}
+
+inline QString operator"" _s(const char16_t *str, size_t size) noexcept
+{
+ return QString(QStringPrivate(nullptr, const_cast<char16_t *>(str), qsizetype(size)));
+}
+
+} // StringLiterals
+} // Literals
+} // Qt
+
+#endif // < 6.4
+
+#endif // QTCOMPAT_H