0
点赞
收藏
分享

微信扫一扫

Qt4——精彩实例分析1

楚木巽 2022-03-11 阅读 40
c++qt
#include "mainwindow.h"
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;

    QPushButton b("helloworld");//创建按键对象,并设置他的显示文本为“helloworld”

    b.show(); //显示按键,控件被创建时默认是不显示的

    QObject::connect(&b,SIGNAL(clicked()),&a,SLOT(quit())); //信号与槽机制,点击之后退出窗口
    
    return a.exec();//进入消息循环等待可能输入进行响应
}

举报

相关推荐

0 条评论