现在的位置: 首页 > 综合 > 正文

Qt之hello world

2013年10月05日 ⁄ 综合 ⁄ 共 358字 ⁄ 字号 评论关闭

 cpp文件 

#include <QApplication>
#include <QPushButton>
#include <QMessageBox>
int main(int argv,char *argc[])
{
    QApplication app(argv,argc);//管理QtGUI程序包括程序初始化、事件响应机制的循环、程序销毁等

    QPushButton button(QObject::tr("click"));
    button.show();
    QMessageBox msg;
    msg.setText("Hello world");
    QObject::connect(&button,SIGNAL(clicked()),&msg,SLOT(show()));//信号与槽(不求甚解)

    return app.exec();//开始事件驱动循环
}

微笑

抱歉!评论已关闭.