Dennis
Dennis

Reputation: 186

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

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.

Upvotes: 3

Views: 3925

Answers (1)

Nikita
Nikita

Reputation: 960

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

Upvotes: 5

Related Questions