Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
None
-
6.9.0
-
None
Description
I have a checkbox that gets set from a signal from another class. I disable signals with blockSignals(true) set the check box, then call blockSignals(false) to allow signals again. The toggled signal is still received when the setChecked call is made.
connect(_framingModeCheckBox, &QCheckBox::toggled, this, [this](bool checked) { // this signal is received from setChecked, even though signals are blocked __debugbreak(); }); connect(_photoViewer, &PhotoViewer::signalFramingModeEnable, this, [this](bool checked) { blockSignals(true); // sends out a toggle, also _framingModeCheckBox->setChecked(checked); blockSignals(false); });
void QAbstractButtonPrivate::emitToggled(bool checked) { Q_Q(QAbstractButton); QPointer<QAbstractButton> guard(q); emit q->toggled(checked); <----- This signal is serviced even when blocked . . . }
Attached is an example that reproduces the issue. In Visual Studio, compile and run the project. Hit the "Send Signal" button. The PhotoViewer class will issue a signal to set the checkbox mentioned above. _{}debugbreak{_} is called if the toggled signal is received when blocked.