PDA

View Full Version : QCheckBox dependency



jd
1st April 2008, 10:23
Hello, i have a problem with QCheckBox.

I have two checkboxes:
Checkbox A and Checkbox B

Checkbox A is dependently on checkbox B
Cehckbox B is dependently on checkbox A

If I set checkbox A checked(true), checkbox B must be set checked(false).
If I set checkbox B checked(ture), checkbox A must ne set checked(false).

The problem is i can not handle this in one SLOT-function, because I don't know wich checkbox released the SIGNAL toggled(bool).

Connects:


connect(AcheckBox, SIGNAL( toggled( bool ) ),
this, SLOT( dependencyCheckBox( bool )));
connect(BcheckBox, SIGNAL( toggled( bool ) ),
this, SLOT( dependencyCheckBox( bool )));


How can I find out which checkbox was checked? Can I handed Over the object name?



so long

jd

wysota
1st April 2008, 10:32
If I set checkbox A checked(true), checkbox B must be set checked(false).
If I set checkbox B checked(ture), checkbox A must ne set checked(false).

Why don't you use radio buttons instead? If you don't want them, at least take a look at QButtonGroup.

jd
1st April 2008, 13:12
QRadioButton works fine.

thanks.