|
1Qter豆
报错:
D:\Qt\book\Qt5\src\02\2-2\helloworld\main.cpp:9: error: 'setCodecForTr' is not a member of 'QTextCodec'
QTextCodec::setCodecForTr(QTextCodec::codecForLocale());
^
代码:
#include <QApplication>
#include <QWidget>
#include <QDialog>
#include <QLabel>
#include <QTextCodec>
int main(int argc,char *argv[])
{
QApplication a(argc,argv);
QTextCodec::setCodecForTr(QTextCodec::codecForLocale()); //这行报错
QDialog w;
w.resize(400,300);
QLabel label(&w);
label.move(120,120);
label.setText(QObject::tr("Hello World!你好Qt!"));
w.show();
return a.exec();
}
|
最佳答案
查看完整内容
用的是QT5吧。看看这篇文章。http://blog.csdn.net/dbzhang800/article/details/7325698
|