diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-03 10:17:58 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-03 10:17:58 +0100 |
commit | f7481e685dc45c9eff0245249a8a83da79d6808c (patch) | |
tree | 2f544b83f35bc72f10ae2385a091e860b99c19d5 /compat/qt-signal.hpp | |
parent | 5e73075e75e593cefecfd8ac4d370942303728e9 (diff) |
opentrack: get rid of Q_OBJECT
More work toward mixins.
Diffstat (limited to 'compat/qt-signal.hpp')
-rw-r--r-- | compat/qt-signal.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/compat/qt-signal.hpp b/compat/qt-signal.hpp new file mode 100644 index 00000000..119e063c --- /dev/null +++ b/compat/qt-signal.hpp @@ -0,0 +1,30 @@ +#pragma once + +// this is to avoid dealing with QMetaObject for the time being -sh 20190203 + +#include "export.hpp" +#include <QObject> + +namespace qt_sig { + +class OTR_COMPAT_EXPORT nullary : public QObject +{ + Q_OBJECT + +public: + template<typename t, typename F> + nullary(t* datum, F&& f, Qt::ConnectionType conntype = Qt::AutoConnection) : QObject(datum) + { + connect(this, &nullary::notify, datum, f, conntype); + } + + nullary(QObject* parent = nullptr); + ~nullary() override; + + void operator()() const; + +signals: + void notify() const; +}; + +} // ns qt_sig |