- 论坛徽章:
- 0
|
想请教一下熟悉QT的朋友~怎样在里面正常显示中文
#include <qapplication.h>;
#include <qwidget.h>;
#include <qpushbutton.h>;
#include <qfont.h>;
#include <qstring.h>;
class MyMainWindow :public QWidget
{
public:
MyMainWindow();
private:
QPushButton *b1;
};
MyMainWindow::MyMainWindow()
{
//QString ch;
b1 = new QPushButton( this,"b1" );
b1->;setText( trUtf8( "\xe4\xb8\xad\xe6\x96\x87 中文" ) );
b1->;setGeometry( 20, 20, 300, 300 );
b1->;setFont( QFont( "Times", 18, QFont::Bold ) );
}
void main( int argc, char **argv )
{
QApplication a( argc, argv );
MyMainWindow w;
a.setMainWidget( &w );
w.show();
a.exec();
}
只是一个简单的pushbutton的代码
\xe4\xb8\xad\xe6\x96\x87 在执行文件中显示出来是“中文”
它后面的”中文“出来是乱码
另外我不知道怎么用QString来显示中文
你可以告诉我一下吗 |
|