From ed827acc27530a97b84685920615359010d74f48 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 1 Mar 2012 18:52:32 +0100 Subject: QSignalBlocker: (new) RAII class for QObject::blockSignals() I don't think I ever worked on a project of non-trivial size that didn't at some point add a QSignalBlocker. This commit adds code, tests and documentation. Later commits will convert naked blockSignals() calls to use QSignalBlocker. The implementation is purely inline to avoid the heavy overhead of cross-dll function calls for this miniscule task. This should not be a problem because QSignalBlocker only uses public API and a pattern that we anyway need to keep working until Qt 6, at least, so even changing the implementation later will be no problem as the old implementation lurking in non-recompiled code will be acceptable, too. This implementation is an evolution from KDTools' KDSignalBlocker, with the following changes: - Implements unblock() and reblock() - Uses the return value of blockSignals() instead of a separate signalsBlocked() call. Change-Id: I1933dfd72a0f5190324be377cfca3c54cf3d6828 Reviewed-by: Olivier Goffart --- dist/changes-5.3.0 | 2 ++ 1 file changed, 2 insertions(+) (limited to 'dist/changes-5.3.0') diff --git a/dist/changes-5.3.0 b/dist/changes-5.3.0 index 87d9c771e7..035d0656ed 100644 --- a/dist/changes-5.3.0 +++ b/dist/changes-5.3.0 @@ -25,5 +25,7 @@ QtWidgets QtCore ------ +- QSignalBlocker: (new) RAII wrapper around QObject::blockSignals() + QtGui ----- -- cgit v1.2.3