Qt之hello world

 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();//開始事件驅動循環
}
微笑
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章