connect

普遍用法

connect(&对象,&对象类型::信号,&对象,&对象类型::槽函数)  //对象指针也可以

connect对于信号带参、或有重载的

connect(ui->spinBox_morphIter, static_cast<void (QSpinBox::*) (int)>(&QSpinBox::valueChanged), [=](){emit updateNeeded(); });

智能指针

Qt智能指针信号槽连接问题_qt connect 智能指针_Jason~shen的博客-CSDN博客 

旧的方式,槽函数必须使用slots修饰

connect(&buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(OnZoom(int)));

 

【参考】

(5条消息) QT中connect函数的几种用法详解总结_疯狂挖掘机的博客-CSDN博客_qt中connect函数用法 

posted @ 2022-03-10 11:16  夕西行  阅读(245)  评论(0编辑  收藏  举报