What is a "Qt Signal Blocker"? The Most Authoritative Explanation.
What is a "Qt Signal Blocker"? The Most Authoritative Explanation.
Where can I use qsignalblocker?
QSignalBlocker can be used wherever you would otherwise use a pair of calls to blockSignals (). It blocks signals in its constructor and in the destructor it resets the state to what it was before the constructor ran. except the code using QSignalBlocker is safe in the face of exceptions. See also QMutexLocker and QEventLoopLocker.
How to block a signal in QObject?
If you just don't want the signal to be emitted at one specific time, you can use QObject::blockSignals like this: bool oldState = checkBox->blockSignals(true); checkBox->setChecked(true); checkBox->blockSignals(oldState); The downside of this approach is that all signals will be blocked.
Why do I need a signal blocker?
Per the docs the whole reason of the signal blocker is just convenience so that you don't have to block and then un-block signals. Not the answer you're looking for?
What happens when you move an object with a signal blocker?
The object's signals this signal blocker was blocking prior to being moved to, if any, are unblocked except in the case where both instances block the same object's signals and *this is unblocked while other is not, at the time of the move. Destructor.
Related Articles
How To Make A Cell Phone Jammer Using A Transistor?