显示中文字符串,利用一个函数
Qobject::tr()
eg
//helloWorld.pro
QT += widgets //和qt4兼容
//main.cpp
#include <QApplication>
#include <QDialog>
#include <QLabel>
int main(int argc, char* argv[])
{
QApplication a(argc,argv);
QDialog w;
w.resize(400,300);
QLabel label(&w);//对话框为标签的父窗口
label.move(120,120);
label.setText(QObject::tr("Hello world!你好世界"));
w.show();
return a.exec();
}