[Development] Why we *have to* remove codecFor... ?

Loaden loaden at gmail.com
Sun Apr 22 10:03:04 CEST 2012


Hi, All! I am only a physics teacher from China.  It makes me
confused  that I just noticed the codecFor... function is removed for now.
See:
https://codereview.qt-project.org/#change,14626
https://codereview.qt-project.org/#change,14999

But please let's me know how to make this work with **MSVC2010**?

#include <QApplication>
> #include <QLabel>
> #include <QTextCodec>
> #include <QTextStream>
> #include <QDebug>
> int main(int argc, char *argv[])
> {
> #ifdef Q_OS_WIN
>     QTextCodec *codec = QTextCodec::codecForName("GBK");
>     QTextCodec::setCodecForLocale(codec);
> #if QT_VERSION < 0x050000
>     QTextCodec::setCodecForCStrings(codec);
>     QTextCodec::setCodecForTr(codec);
> #endif
> #endif
>     QApplication app(argc, argv);
>     QString str = QString::fromAscii("Hello世界World!你好!");
>     QTextStream out(stdout);
>     qDebug() << "Hello世界World!你好!";
>     out << str << endl;
>     QLabel *label = new QLabel(str + QObject::tr("Hello世界World!你好!"));
>     label->show();
>     return app.exec();
> }

In Qt4, It's works fine!!
That so sad, It's not work in Qt5!

In currently, I does't test it on Linus yet, But It's should works well
whether use Qt4 or Qt5.
But don't abandoned Windows, and *MSVC* compiler.

-- 
Best Regards
Loaden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120422/02374988/attachment.html>


More information about the Development mailing list