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

Popular posts from this blog

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -