头文件包含:#include <QTextCodec>
在QApplication app(argc,argv);之后加:
QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK"));
显示中文时调用:
QObject::tr("中文")
例如:
QLabel hello(QObject::tr("你好世界"));