QSignalBlocker Class
The QSignalBlocker class exception-safely wraps QObject::blockSignals(). More…
| Header | #include <QSignalBlocker> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Core) |
| Module | Nt Core C++ Classes |
List of all members, including inherited members
Public Functions
| QSignalBlocker(QObject *o) | |
| QSignalBlocker(QObject &o) | |
| ~QSignalBlocker() | |
| QSignalBlocker(QSignalBlocker &&other) | |
| QSignalBlocker & | operator=(QSignalBlocker &&other) |
| void | reblock() |
| void | unblock() |
| void | dismiss() |
Detailed Description
A QSignalBlocker blocks the signals of an object for as long as it exists, and restores the previous blocked state on destruction.
See also QObject::blockSignals().
Differences from Qt
None.
Member Function Documentation
QSignalBlocker::QSignalBlocker(QObject *o)
Constructs a blocker that blocks the signals of o. Does nothing if o is nullptr.
QSignalBlocker::QSignalBlocker(QObject &o)
This is an overloaded function.
Constructs a blocker that blocks the signals of o.
QSignalBlocker::QSignalBlocker(QSignalBlocker &&other)
Constructs a blocker that takes over the object of other; other then restores nothing when it is destroyed.
QSignalBlocker::~QSignalBlocker()
Restores the object's previous signal-blocking state.
void QSignalBlocker::dismiss()
Makes the blocker forget its object: the destructor then leaves the object's signal-blocking state as it is.
This function was introduced in 6.7.
See also unblock().
QSignalBlocker & QSignalBlocker::operator=(QSignalBlocker &&other)
Restores the state of the current object, then takes over the object of other, and returns a reference to this blocker.
void QSignalBlocker::reblock()
Blocks the object's signals again after unblock().
See also unblock().
void QSignalBlocker::unblock()
Restores the object's previous signal-blocking state, as the destructor would, without destroying the blocker.
See also reblock().