The Stack Overflow question reads:
Is there a practical difference between the QCheckBox::toggled(bool)
and QCheckBox::clicked(bool)
signals? Both have the same signature,
does it matter to which one I connect?
Well, the commenter cost me a couple of minutes by linking to the wrong page, but I did eventually find these two references:
void QAbstractButton::toggled ( bool checked ) [signal]
This signal is emitted whenever a checkable button changes its state.
checked is true if the button is checked, or false if the button is
unchecked.
This may be the result of a user action, click() slot activation, or
because setChecked() was called.
The states of buttons in exclusive button groups are updated before
this signal is emitted. This means that slots can act on either the
"off" signal or the "on" signal emitted by the buttons in the group
whose states have changed.
For example, a slot that reacts to signals emitted by newly checked
buttons but which ignores signals from buttons that have been
unchecked can be implemented using the following pattern:
void MyWidget::reactToToggle(bool checked)
{
if (checked) {
// Examine the new button states.
...
}
}
Button groups can be created using the QButtonGroup class, and updates
to the button states monitored with the QButtonGroup::buttonClicked()
signal.
And...
void QAbstractButton::clicked ( bool checked = false ) [signal]
This signal is emitted when the button is activated (i.e. pressed down
then released while the mouse cursor is inside the button), when the
shortcut key is typed, or when click() or animateClick() is called.
Notably, this signal is not emitted if you call setDown(),
setChecked() or toggle().
If the button is checkable, checked is true if the button is checked,
or false if the button is unchecked.
See also pressed(), released(), and toggled().
Mkay...
The Stack Overflow answer says:
The toggled
signal is emited every time the check state of the
checkbox changes, even if it changes through code, while the clicked
signal is emited only when the user interacts with the checkbox, eg:
ui->checkbox->setChecked(true); // toggled will be emited but not clicked
Well. I'd say that's a useful clarification.
Verdict: Good question, good answer.