xx.cpp
// 设置二态按钮 参考https://qtguide.ustclug.org/
ui->pushButton->setCheckable(true);
connect(ui->pushButton, SIGNAL(clicked(bool )), this, SLOT(slot_on_pushButton_clicked(bool )));
void slot_on_pushButton_clicked(bool checked)
{
if (checked)
else
}
xx.h
protected slots:
void slot_on_pushButton_clicked(bool checked);
之后点击就可以连接上槽函数了
之前写的
connect(ui->pushButton, SIGNAL(clicked(bool checked)), this, SLOT(slot_on_pushButton_clicked(bool checked)));
死活都连不上