6.0.0-rc4Source

QSignalBlocker Class

The QSignalBlocker class exception-safely wraps QObject::blockSignals(). More…

Header#include <QSignalBlocker>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt 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)
voidreblock()
voidunblock()
voiddismiss()

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

[explicit] QSignalBlocker::QSignalBlocker(QObject *o)

Constructs a blocker that blocks the signals of o. Does nothing if o is nullptr.

[explicit] 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().