Hello
i have a question about the QCheckbox.
-I have a checkbox (checkbox1) when I click on the checkmark I want that checkbox2(checkbox2) is also checkmarked.
How can i do this?
Printable View
Hello
i have a question about the QCheckbox.
-I have a checkbox (checkbox1) when I click on the checkmark I want that checkbox2(checkbox2) is also checkmarked.
How can i do this?
Read here: http://qt-project.org/doc/qt-4.8/signalsandslots.html about the signals and slots concept of Qt.
You can connect thesignal of the first checkbox to a self-defined slot that checkmarks the other one.Code:
stateChanged ( int state )
N.B.: If you do this vice-versa, you should be aware that it might be nessecary to temporarily disconnect the connection in order not to get into an infinite loop.
You can also use.
Code:
if(QCheckbox1->isChecked()) QCheckbox2->setChecked(true);