一、函數原型
inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal, const char *amember, Qt::ConnectionType atype)
二、應用
//直接調用 lambda,信號必須用指針的形式寫
connect(act, &QAction::triggered, [=](){
if (itemId.isEmpty()) {
App::showMessageBoxError(tr("錯誤"), tr("請先設置單位信息,再設置席位!"));
return;
}
DialogSeats *dialogSeats = new DialogSeats(itemId, this);
int result = dialogSeats->exec();
if (result == QDialog::Accepted) {
refreshTree();
}
delete dialogSeats;
});
menu->addAction(act);
menu->exec(this->cursor().pos());
}
備註:直接調用 lambda,信號必須用指針的形式寫!!!