qt/e 3.3.3汉字显示始终是方框,程序如下:
int main( int argc, char **argv )
{
QApplication a( argc, argv );
char *string = "中文按钮";
QTextCodec* gbk_codec = QTextCodec::codecForName("GBK");
QString gbk_string = gbk_codec->toUnicode(string);
//QLabel *label = new QLabel(gbk_string);
//a.setDefaultCodec( QTextCodec::codecForName("GBK") );
QPushButton quit( gbk_string,0 );
quit.resize( 75, 30 );
//quit.setFont( QFont( "Times", 18, QFont::Bold ) );
QObject::connect( &quit, SIGNAL(clicked()), &a, SLOT(quit()) );
a.setMainWidget( &quit );
quit.show();
return a.exec();
}
[ 此贴被XChinux在2006-01-15 22:37重新编辑 ]