我看了几个examples里的例子,不过还是不太明白。如果要把一个qte下最简单的例子移植到qtopia下运行还需要改哪些东西,比如:
#include <qtopia/qpeapplication.h>
#include <qstring.h>
#include <qpushbutton.h>
#include <qtextcodec.h>
#include <iostream.h>
int main( int argc, char **argv )
{
QPEApplication a( argc, argv );
QFont font( "unifont", 16, QFont::Normal, FALSE );
a.setFont( font );
char *string = "中文按钮";
QTextCodec *gbk_codec = QTextCodec::codecForName("GBK");
QString gbk_string = gbk_codec->toUnicode(string);
QPushButton quit( gbk_string,0 );
quit.resize( 100, 50 );
QObject::connect( &quit, SIGNAL(clicked()), &a, SLOT(quit()) );
a.showMainWidget( &quit );
return a.exec();
}
pro文件是:
TEMPLATE = app
CONFIG += qtopia warn_on release
SOURCES = chinese.cpp
[ 此贴被XChinux在2006-06-14 19:32重新编辑 ]