c++ - How to disable a QPushButton when deselect a QCheckBox -
i'm working in qt project user can enable or disable qpushbutton selecting or deselecting qcheckbox.
have developed function mouse event enable qpushbutton, problem when deselect qcheckbox qpushbutton remain enabled.
there qt function disable button when qcheckbox unchecked?
this code wrote:
//class.h //function enable button private slots: void on_qcheckbox_clicked(); //class.cpp void class::on_qcheckbox_clicked() { ui->qpushbutton->setenabled(true); //here enabled button setenabled function }
thanks @scheff!
i solved using qobject::connect()
connect qcheckbox , qpushbutton together
here example:
class::class() { qobject::connect(ui->qcheckbox, &qcheckbox::toggled, ui->qpushbutton, &qpushbutton::setenabled); //where ui->qcheckbox checkbox , ui->qpushbutton button }
Comments
Post a Comment