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?
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.Qt Code:
stateChanged ( int state )To copy to clipboard, switch view to plain text mode
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.
Qt Code:
if(QCheckbox1->isChecked()) QCheckbox2->setChecked(true);To copy to clipboard, switch view to plain text mode
Last edited by karthic; 27th April 2012 at 11:22.
Bookmarks