Unsolved Qt 6: Replacement for QTextCodec
-
Hello,
for my application I need Quazip which needQTextCodec
in several files. Currently, I usecore5compat
module but I want a clear Qt 6 application. Is there any replacement forQTextCodec
class in Qt 6 (exceptcore5compat
)?Thank you for your answers!
-
Hi, yes I had a similar issue when upgrading to Qt6, I changed to using QStringConverter
Because I sometimes I to build for Qt 5.15.2 my code looks like this example:... // set the text encoding for the stream #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) ts.setCodec(bUtf8 ? "UTF-8" : "ISO 8859-1"); #else ts.setEncoding(bUtf8 ? QStringConverter::Utf8 : QStringConverter::Latin1); #endif ...
-
@hskoglund
Could you please explain better how to use the QTextStream instead the QTextCodec?
I am also porting the QuaZip using only the Qt 6 application (without the core5compat).
Thank you for your answers! -
You mean how to replace QTextCodec with QStringConverter? (QTextStream remains the same in Qt6 as in Qt5)
I've only used QStringConverter for the case shown above but there are more info for example here