Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt - QCheckBox does not emit stateChanged(int state) signal

Tags:

c++

qt

i'm having an issue with the following signal-slot

QCheckBox *hasNotify = new QCheckBox;
connect(hasNotify, SIGNAL(stateChanged(int state)), this, SLOT(showhideNotify(int state)));

I get this in my application output

QObject::connect: No such signal QCheckBox::stateChanged(int state)

But here http://qt-project.org/doc/qt-5/qcheckbox.html#stateChanged they say this signal is included in QCheckBox, so I'm confused about what the problem is.

like image 315
Dennis Avatar asked Jan 17 '26 22:01

Dennis


1 Answers

signal and slots parameters must not contain any variable names, so you should write

connect(hasNotify, SIGNAL(stateChanged(int)), this, SLOT(showhideNotify(int)));

Take a look at documentation here

like image 195
Nikita Avatar answered Jan 20 '26 11:01

Nikita