PDA

View Full Version : Qchekbox problem!!!!! :)



arninio123
26th April 2012, 18:29
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?

sedi
26th April 2012, 19:05
Read here: http://qt-project.org/doc/qt-4.8/signalsandslots.html about the signals and slots concept of Qt.

You can connect the
stateChanged ( int state ) signal of the first checkbox to a self-defined slot that checkmarks the other one.

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.

karthic
27th April 2012, 09:30
You can also use.


if(QCheckbox1->isChecked())
QCheckbox2->setChecked(true);