summaryrefslogtreecommitdiffhomepage
path: root/compat/qt-signal.hpp
blob: 119e063c511f9592bb11da5a6e6a78e73e5d5213 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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