mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Basic implementation of QSignalBlocker for qt4
(cherry picked from commit bc8eb059db
)
This commit is contained in:
parent
49ce94f636
commit
2da2f6c00c
@ -195,6 +195,24 @@ QString changeExtension(QString const & oldname, QString const & ext);
|
||||
/// parameter.
|
||||
QString guiName(std::string const & type, BufferParams const & bp);
|
||||
|
||||
#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
|
||||
|
Loading…
Reference in New Issue
Block a user