01helloworld

来源:互联网 发布:怎样在u盘上编程 编辑:程序博客网 时间:2024/06/06 09:04
#include<QtGui/QApplication>#include<QtGui/QWidget>#include<QtGui/QLabel>#include<QtCore/QTextCodec>#include<QtGui/QPushButton>#include<QtGui/QVBoxLayout>int main(int argc,char *argv[]){    QApplication app(argc,argv);    QTextCodec::setCodecForTr(QTextCodec::codecForName("gb18030"));    QWidget *pWidget = new QWidget;    QLabel label1(pWidget);    label1.setText("One World,One Dream");    QPushButton *pButton = new QPushButton(QObject::tr("关闭"),pWidget);    QVBoxLayout *pLayout = new QVBoxLayout;    pLayout->addWidget(&label1);    pLayout->addWidget(pButton);    pWidget->setLayout(pLayout);    QObject::connect(pButton,SIGNAL(clicked()),pWidget,SLOT(close()));    pWidget->show();    return app.exec();}
原创粉丝点击