Browse Source
e9a6461
Make qt wallet test compatible with qt4 (Russell Yanofsky)
Tree-SHA512: a3e4598986cb3c5c20aaa1d440abc886d84fcc69a6ee4079787cfc8e3a2dce655060ff95612cb15ce8b5a9b8911e4afe2281345b59a4353ec32edf3771338381
0.15
Wladimir J. van der Laan
8 years ago
3 changed files with 37 additions and 5 deletions
@ -0,0 +1,30 @@ |
|||||||
|
#ifndef BITCOIN_QT_CALLBACK_H |
||||||
|
#define BITCOIN_QT_CALLBACK_H |
||||||
|
|
||||||
|
#include <QObject> |
||||||
|
|
||||||
|
class Callback : public QObject |
||||||
|
{ |
||||||
|
Q_OBJECT |
||||||
|
public Q_SLOTS: |
||||||
|
virtual void call() = 0; |
||||||
|
}; |
||||||
|
|
||||||
|
template <typename F> |
||||||
|
class FunctionCallback : public Callback |
||||||
|
{ |
||||||
|
F f; |
||||||
|
|
||||||
|
public: |
||||||
|
FunctionCallback(F f_) : f(std::move(f_)) {} |
||||||
|
~FunctionCallback() override {} |
||||||
|
void call() override { f(this); } |
||||||
|
}; |
||||||
|
|
||||||
|
template <typename F> |
||||||
|
FunctionCallback<F>* makeCallback(F f) |
||||||
|
{ |
||||||
|
return new FunctionCallback<F>(std::move(f)); |
||||||
|
} |
||||||
|
|
||||||
|
#endif // BITCOIN_QT_CALLBACK_H
|
Loading…
Reference in new issue