commit bc8eb059db9f25b0cb44af0a26fba13170971f40
Author: Guillaume Munch <[email protected]>
Date:   Fri Jul 29 21:18:43 2016 +0100

    Basic implementation of QSignalBlocker for qt4
---
 src/frontends/qt4/qt_helpers.h |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/frontends/qt4/qt_helpers.h b/src/frontends/qt4/qt_helpers.h
index 9f239a8..5574212 100644
--- a/src/frontends/qt4/qt_helpers.h
+++ b/src/frontends/qt4/qt_helpers.h
@@ -213,6 +213,24 @@ QString guiName(std::string const & type, BufferParams 
const & bp);
 QString formatToolTip(QString text, int width = 30);
 
 
+#if QT_VERSION < 0x050300
+// Very partial implementation of QSignalBlocker for archaic qt versions.
+class QSignalBlocker {
+public:
+       explicit QSignalBlocker(QObject * o)
+               : obj(o), init_state(obj && obj->blockSignals(true)) {}
+
+       ~QSignalBlocker() {
+               if (obj)
+                       obj->blockSignals(init_state);
+       }
+private:
+       QObject * obj;
+       bool init_state;
+};
+#endif
+
+
 } // namespace lyx
 
 #endif // QTHELPERS_H

Reply via email to