Merge #11676: contrib/init: Update openrc-run filename
[bitcoinplatinum.git] / src / qt / callback.h
blobda6b0c4c2e3c5363f120e279b7292082a25be983
1 #ifndef BITCOIN_QT_CALLBACK_H
2 #define BITCOIN_QT_CALLBACK_H
4 #include <QObject>
6 class Callback : public QObject
8 Q_OBJECT
9 public Q_SLOTS:
10 virtual void call() = 0;
13 template <typename F>
14 class FunctionCallback : public Callback
16 F f;
18 public:
19 explicit FunctionCallback(F f_) : f(std::move(f_)) {}
20 ~FunctionCallback() override {}
21 void call() override { f(this); }
24 template <typename F>
25 FunctionCallback<F>* makeCallback(F f)
27 return new FunctionCallback<F>(std::move(f));
30 #endif // BITCOIN_QT_CALLBACK_H