Jonathan H
Jonathan H

Reputation: 141

Is it possible to add an onclick listener to a QCheckBox?

I have a bunch of dynamically created checkboxes and the last checkbox is labelled: 'check all/ uncheck all'.

Is it possible to have an onclick listener attached to the very last checkbox? Or will I have to resort to using a button?

Upvotes: 2

Views: 459

Answers (1)

MrEricSir
MrEricSir

Reputation: 8242

You probably don't want to listen just for click events, since the state of a QCheckBox can also be triggered by the keyboard. In most cases you'd want to listen to the stateChanged signal.

Upvotes: 2

Related Questions