Skip to content

Commit

Permalink
Qt6: eliminate dependency on Qt5Compat module
Browse files Browse the repository at this point in the history
  • Loading branch information
pbartfai committed Sep 4, 2024
1 parent 895bf53 commit 3e0df8b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions TCFoundation/TCLocalStrings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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());
Expand All @@ -1512,8 +1514,8 @@ void TCLocalStrings::mbstowstring(std::wstring &dst, const char *src,

dst[i] = (wchar_t)qchar.unicode();
}
#endif
}
#endif
#endif // WIN32
else
{
Expand Down
7 changes: 5 additions & 2 deletions TCFoundation/TCLocalStrings.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
#ifdef _QT
#include <QtCore/qglobal.h>
#if QT_VERSION >= 0x60000
#if defined(QT_BUILD_CORE5COMPAT_LIB)
#if defined(QT_CORE5COMPAT_LIB)
#include <QtCore5Compat/QTextCodec>
#else
#include <QtCore/QString>
#endif
#else
#include <QtCore/QTextCodec>
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 3e0df8b

Please sign in to comment.