当前位置: 首页 > 工具软件 > pushbutton > 使用案例 >

qt pushButton 设置二态按钮

洪承天
2023-12-01

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)));

死活都连不上

 类似资料: