#include <qapplication.h>
#include <qwidget.h>
#include <qpushbutton.h>
#include <qfont.h>
#include <qstring.h>
#include <qtextcodec.h>
class MyMainWindow :public QWidget
{
public:
MyMainWindow();
private:
QPushButton *b1;
};
MyMainWindow::MyMainWindow()
{
b1 = new QPushButton( this,"b1" );
b1->setText( tr( " 中文" ) );
b1->setGeometry( 20, 20, 300, 300 );
b1->setFont( QFont( "Times", 18, QFont::Bold ) );
}
int main( int argc, char **argv )
{
QApplication a( argc, argv );
MyMainWindow w;
a.setMainWidget( &w );
w.show();
return a.exec();
}
我就是想让按钮上显示出"中文",两个字但是出来是乱吗,请各位告诉我具体怎么做才能显示出来,我用的是QT-2.3.7,谢谢了!!!!!