mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-24 18:43:37 +00:00
Basic implementation of QSignalBlocker for qt4
This commit is contained in:
parent
69f8ab21ef
commit
bc8eb059db
@ -213,6 +213,24 @@ QString guiName(std::string const & type, BufferParams const & bp);
|
|||||||
QString formatToolTip(QString text, int width = 30);
|
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
|
} // namespace lyx
|
||||||
|
|
||||||
#endif // QTHELPERS_H
|
#endif // QTHELPERS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user