[Qt-interest] Connect checkbox states
John McClurkin
jwm at nei.nih.gov
Tue Jun 16 16:35:48 CEST 2009
Christian Lackas wrote:
> * Alexandre Beraud <aberaud at infflux.com> [090616 16:02]:
>
> Hi Alexandre
>
>> I don't know what you want to achieve exactly, but if the two checkboxes
>> must always have the same state, then there is no point in having two of
>> them. If you want to make them exclusive, take a look at QButtonGroup.
>> In the worst case connect checkBox1 to a slot that blocks the signals
>> from checkBox2, changes its state, and re-enables the signals
>> (blockSignals() function of the QObject class).
>
> I have a couple of the checkboxes (and a couple of other QWidgets) in
> two dialogs, which can be linked together (which is how it is used in
> most cases; however, for fine tuning, you can disable the link and
> adjust the widgets individually).
> It works with most other QWidgets, that allow to transfer the state via
> signal/slot. Just for QCheckBox I can't get it to work, which I find
> strange (since here it should be straight forward; so I wonder if I just
> don't see it).
>
> Christian
>
You are going to have to connect the stateChanged signal of a checkbox
in one dialog to a slot in the other dialog and set the check state of
the second dialog's checkbox from within the slot.
More information about the Qt-interest-old
mailing list