最近单位要把软件QT化,借此机会也学习学习这个跨平台的UI库,把平时遇到的问题记录下来,以供大家参考
#include
#include
#include
#include
#include
#include
#include
int main(int argc, char **argv)
{
QApplication a(argc,argv);
//a.setDefaultCodec(QTextCodec::codecForName("GBK"));
QWidget window;
QHBoxLayout box;
QTextCodec::setCodecForTr(QTextCodec::codecForName("gb18030"));
QFont font("Simsun",12,QFont::Normal,FALSE);
a.setFont(font);
//font.setFamily ("c:\\windows\\fonts\\simhei.ttf");
QPushButton quit(QObject::tr("退出"),0);
//quit.setFont( QFont( "Simhei", 18, QFont::Bold ) );
QObject::connect(&quit,SIGNAL(clicked()),&a,SLOT(quit()));
box.addWidget(&quit);
window.setLayout(&box);
window.show();
return a.exec();
}
阅读(1640) | 评论(0) | 转发(0) |