QT5中已经除去了QTextCodec::setCodecForTr()和QTextCodec::setCodecForCString()这两个函数。
为解决此问题。使用QStringLiteral (); 注意:包含头文件是:#include<QtCore/QString>
整个程序备注:
#include<QApplication>
#include<QDialog>
#include<QLabel>
#include<QtCore/QString>
intmain(intargc,char*argv[])
{
QApplicationa(argc,argv);
QDialogw;
QLabellabel(&w);
label.setText(QStringLiteral("Helloworld!您好!"));
w.show();
returna.exec();
}