Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
Exception-safe wrapper around QObject::blockSignals(). More...
#include <qobject.h>
Public Member Functions | |
Q_NODISCARD_CTOR | QSignalBlocker (QObject *o) noexcept |
Constructor. | |
Q_NODISCARD_CTOR | QSignalBlocker (QObject &o) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Calls {object}.blockSignals(true). | |
~QSignalBlocker () | |
Destructor. | |
Q_NODISCARD_CTOR | QSignalBlocker (QSignalBlocker &&other) noexcept |
Move-constructs a signal blocker from other. | |
QSignalBlocker & | operator= (QSignalBlocker &&other) noexcept |
Move-assigns this signal blocker from other. | |
void | reblock () noexcept |
Re-blocks signals after a previous unblock(). | |
void | unblock () noexcept |
Temporarily restores the QObject::signalsBlocked() state to what it was before this QSignalBlocker's constructor ran. | |
void | dismiss () noexcept |
Exception-safe wrapper around QObject::blockSignals().
\inmodule QtCore
\reentrant
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.
is thus equivalent to
except the code using QSignalBlocker is safe in the face of exceptions.
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Calls {object}.blockSignals(true).
|
inline |
Destructor.
Restores the QObject::signalsBlocked() state to what it was before the constructor ran, unless unblock() has been called without a following reblock(), in which case it does nothing.
|
inlinenoexcept |
Move-constructs a signal blocker from other.
other will have a no-op destructor, while responsibility for restoring the QObject::signalsBlocked() state is transferred to the new object.
|
inlinenoexcept |
|
inlinenoexcept |
Move-assigns this signal blocker from other.
other will have a no-op destructor, while responsibility for restoring the QObject::signalsBlocked() state is transferred to this object.
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.
Definition at line 526 of file qobject.h.
References unblock().
|
inlinenoexcept |
|
inlinenoexcept |
Temporarily restores the QObject::signalsBlocked() state to what it was before this QSignalBlocker's constructor ran.
To undo, use reblock().
The numbers of reblock() and unblock() calls are not counted, so every unblock() undoes any number of reblock() calls.
Definition at line 555 of file qobject.h.
Referenced by operator=().