Can I make the QCheckBox label clickable?



  • Normally when creating a QCheckBox with a label, the label does not respond to clicks of the mouse.

    Is there a simple way to let the checkbox respond to clicks on the labels instead of only responding to clicks exactly on the checkbox itself?



  • hI @Jakob

    Have you tried to create an inherited class from QCheckbox, and reimplement the mousePressEvent() Virtual Function?



  • Nevermind - in the end it turned out the label was modeled as a separate QLabel instead of the text of the QCheckBox. Once I removed the label, and put the text inside the checkbox, I got exactly what I was asking for.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.