axylp123的个人主页

http://www.qtcn.org/bbs/u/154703  [收藏] [复制]

axylp123

  • 1

    关注

  • 1

    粉丝

  • 16

    访客

  • 等级:新手上路
  • 总积分:15
  • 男,1987-10-10

最后登录:2017-06-01

更多资料

日志

1.2 建立连接

2015-11-26 18:16
#include <QApplication>
#include <QPushButton>
int main(int argc, char** argv)
{
    QApplication app(argc, argv);
    QPushButton button(QObject::tr("Quit"));
    button.show();
    //信号槽链接,当button对象被点击时发射clicked()信号,
    //app对象接收到信号后,执行槽函数quit()
    QObject::connect(&button, SIGNAL(clicked()),  &app, SLOT(quit()));
    button.show();
    return app.exec();
}
//bool QObject::connect(const QObject   *sender,     //发出信号的对象
//                      const char      *signal,     //信号
//                      const QObject   *receiver,   //接收信号的对象
//                      const char      *method,     //对象接收到信号后的处理
//                      Qt::ConnectionType type = Qt::AutoConnection ) [static] //连接方式
//                        type:
//                            Qt::AutoConnection
//                            Qt::DirectConnection
//                            Qt::QueuedConnection
//                            Qt::BlockingQueuedConnection
//                            Qt::UniqueConnection
//                            Qt::AutoCompatConnection

分类:C++GUIQt4|回复:0|浏览:969|全站可见|转载
 

下一篇: 1.3 窗口部件的布局

上一篇: 1.1 HelloQt

Powered by phpwind v8.7 Certificate Copyright Time now is:12-07 03:38
©2005-2016 QTCN开发网 版权所有 Gzip disabled