QSignalBlocker¶
Exception-safe wrapper around
blockSignals()
. More…
Synopsis¶
Functions¶
Detailed Description¶
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.{ const QSignalBlocker blocker(someQObject); // no signals here }is thus equivalent to
const bool wasBlocked = someQObject->blockSignals(true); // no signals here someQObject->blockSignals(wasBlocked);except the code using
QSignalBlocker
is safe in the face of exceptions.See also
QMutexLocker
QEventLoopLocker
- class PySide2.QtCore.QSignalBlocker(o)¶
PySide2.QtCore.QSignalBlocker(o)
- param o:
Constructor. Calls
object
->blockSignals(true).
- PySide2.QtCore.QSignalBlocker.reblock()¶
Re-blocks signals after a previous
unblock()
.The numbers of and
unblock()
calls are not counted, so every undoes any number ofunblock()
calls.
- PySide2.QtCore.QSignalBlocker.unblock()¶
Temporarily restores the
signalsBlocked()
state to what it was before thisQSignalBlocker
‘s constructor ran. To undo, usereblock()
.The numbers of
reblock()
and calls are not counted, so every undoes any number ofreblock()
calls.
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.