1

I have a QCheckbox and which I'm trying to change the state using a keyboard press of return/enter, rather than space.

For other things such as QPushbuttons/QLineEdit, I've used returnPressed() in the signal, however this doesnt work for QCheckbox and none of the options seem suitable.

How do I change the state of the QCheckbox on return/enter press when it has focus.

The code I've tried is

QObject::connect(ui->operator_checkbox, SIGNAL(returnPressed()), 
 ui->operator_checkbox, SLOT(setChecked(true)));
demonplus
  • 5,613
  • 12
  • 49
  • 68
easty
  • 35
  • 6

0 Answers0