// Coding: UTF-8(BOM)
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
# pragma execution_character_set("utf-8")
#endif
#include <QApplication>
#include <QTextCodec>
#include <QLabel>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
#if defined(_MSC_VER) && (_MSC_VER < 1600)
QTextCodec::setCodecForTr(QTextCodec::codecForName("GB18030-0"));
#else
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
#endif
#endif
QLabel *label = new QLabel(QObject::tr("你好!"));
label->show();
return app.exec();
}
转载自:
http://blog.163.com/qimo601@126/blog/static/1582209320143115334438/