图片开关新增选中切换信号

This commit is contained in:
feiyangqingyun
2022-04-28 08:36:11 +08:00
parent b2c999dd83
commit 293a8d9c40
4 changed files with 19 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
#include "frmimageswitch.h"
#include "ui_frmimageswitch.h"
#include "qdebug.h"
frmImageSwitch::frmImageSwitch(QWidget *parent) : QWidget(parent), ui(new Ui::frmImageSwitch)
{
@@ -19,10 +20,22 @@ void frmImageSwitch::initForm()
ui->imageSwitch1->setChecked(true);
ui->imageSwitch2->setChecked(true);
ui->imageSwitch3->setChecked(true);
ui->imageSwitch1->setFixedSize(87, 30);
ui->imageSwitch2->setFixedSize(87, 30);
ui->imageSwitch3->setFixedSize(87, 30);
ui->imageSwitch1->setButtonStyle(ImageSwitch::ButtonStyle_1);
ui->imageSwitch2->setButtonStyle(ImageSwitch::ButtonStyle_2);
ui->imageSwitch3->setButtonStyle(ImageSwitch::ButtonStyle_3);
//绑定选中切换信号
connect(ui->imageSwitch1, SIGNAL(checkedChanged(bool)), this, SLOT(checkedChanged(bool)));
connect(ui->imageSwitch2, SIGNAL(checkedChanged(bool)), this, SLOT(checkedChanged(bool)));
connect(ui->imageSwitch3, SIGNAL(checkedChanged(bool)), this, SLOT(checkedChanged(bool)));
}
void frmImageSwitch::checkedChanged(bool checked)
{
qDebug() << sender() << checked;
}