From 3e0df8b0792ee9e2d53613c5d184476a2b1dc157 Mon Sep 17 00:00:00 2001 From: Peter Bartfai Date: Wed, 4 Sep 2024 15:10:25 +0200 Subject: [PATCH] Qt6: eliminate dependency on Qt5Compat module --- TCFoundation/TCLocalStrings.cpp | 8 +++++--- TCFoundation/TCLocalStrings.h | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/TCFoundation/TCLocalStrings.cpp b/TCFoundation/TCLocalStrings.cpp index f4643ea7..a472b9c2 100644 --- a/TCFoundation/TCLocalStrings.cpp +++ b/TCFoundation/TCLocalStrings.cpp @@ -855,7 +855,9 @@ TCLocalStrings::TCLocalStringsCleanup::~TCLocalStringsCleanup(void) // Note: Code Page 1252 is Windows Latin I, which is the default. TCLocalStrings::TCLocalStrings(void): #if !defined(WIN32) && !defined(__APPLE__) && !defined(_OSMESA) +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) || defined(QT_CORE5COMPAT_LIB) m_textCodec(NULL), +#endif #endif // WIN32 m_codePage(UTF8_CODE_PAGE) { @@ -1267,7 +1269,7 @@ void TCLocalStrings::instSetCodePage(int codePage) QString name; name = QString("CP%1").arg(codePage); -#if QT_VERSION < QT_VERSION_CHECK(6,0,0) || defined(QT_BUILD_CORE5COMPAT_LIB) +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) || defined(QT_CORE5COMPAT_LIB) m_textCodec = QTextCodec::codecForName((const char *)name.toLatin1().constData()); #endif @@ -1500,9 +1502,9 @@ void TCLocalStrings::mbstowstring(std::wstring &dst, const char *src, } } #if !defined(WIN32) && !defined(__APPLE__) && !defined(_OSMESA) +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) || defined(QT_CORE5COMPAT_LIB) else if (m_textCodec) { -#if QT_VERSION < QT_VERSION_CHECK(6,0,0) || defined(QT_BUILD_CORE5COMPAT_LIB) QString unicodeString = m_textCodec->toUnicode(src); dst.clear(); dst.resize(unicodeString.length()); @@ -1512,8 +1514,8 @@ void TCLocalStrings::mbstowstring(std::wstring &dst, const char *src, dst[i] = (wchar_t)qchar.unicode(); } -#endif } +#endif #endif // WIN32 else { diff --git a/TCFoundation/TCLocalStrings.h b/TCFoundation/TCLocalStrings.h index bb1bd3d4..1d24031e 100644 --- a/TCFoundation/TCLocalStrings.h +++ b/TCFoundation/TCLocalStrings.h @@ -7,8 +7,10 @@ #ifdef _QT #include #if QT_VERSION >= 0x60000 -#if defined(QT_BUILD_CORE5COMPAT_LIB) +#if defined(QT_CORE5COMPAT_LIB) #include +#else +#include #endif #else #include @@ -62,8 +64,9 @@ class TCExport TCLocalStrings: public TCObject #if !defined(WIN32) && !defined(__APPLE__) && !defined(_OSMESA) //QStringQStringMap m_qStrings; QString m_emptyQString; +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) || defined(QT_CORE5COMPAT_LIB) QTextCodec *m_textCodec; - +#endif //void buildQStringMap(void); #endif // WIN32