DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
qsignalblocker.h
Go to the documentation of this file.
1 #ifndef QSIGNALBLOCKER_H
2 #define QSIGNALBLOCKER_H
3 
4 #include <QObject>
5 
6 #include <QtGlobal>
7 #if QT_VERSION >= 0x050300
8 #include <QSignalBlocker>
9 #else
11  QObject *obj;
12  bool mWasBlocked;
13 
14 public:
15  explicit QSignalBlocker(QObject *object)
16  : obj(object), mWasBlocked(obj!= nullptr && obj->signalsBlocked()) {
17  if (obj != nullptr)
18  obj->blockSignals(true);
19  }
20 
22  if (obj != nullptr)
23  obj->blockSignals(mWasBlocked);
24  }
25 };
26 
27 #endif
28 
29 #endif // QSIGNALBLOCKER_H
QSignalBlocker(QObject *object)
Definition: qsignalblocker.h:15
Definition: qsignalblocker.h:10
~QSignalBlocker()
Definition: qsignalblocker.h:21