diff options
| author | Russell Yanofsky <[email protected]> | 2017-03-27 14:34:38 -0400 |
|---|---|---|
| committer | Russell Yanofsky <[email protected]> | 2017-03-27 14:34:38 -0400 |
| commit | e9a64615c8e18692a775765787f404266767260b (patch) | |
| tree | 4513ecb574ca9bdb3526cfea8713b068a5035bb5 /src/qt/test/wallettests.cpp | |
| parent | Merge #10039: Fix compile errors with Qt 5.3.2 and Boost 1.55.0 (diff) | |
| download | discoin-e9a64615c8e18692a775765787f404266767260b.tar.xz discoin-e9a64615c8e18692a775765787f404266767260b.zip | |
Make qt wallet test compatible with qt4
Unlike Qt5, the Qt4 signals implementation doesn't allow a signal to be
directly connected to a c++ lambda expression. Work around this by defining a
Callback QObject with a virtual method that can forward calls to a closure.
The Qt4 error was reported by Patrick Strateman <[email protected]>
in https://github.com/bitcoin/bitcoin/pull/10039#issuecomment-289248763
Diffstat (limited to 'src/qt/test/wallettests.cpp')
| -rw-r--r-- | src/qt/test/wallettests.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index 36d93361d..b7c1e4c4d 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -1,6 +1,7 @@ #include "wallettests.h" #include "qt/bitcoinamountfield.h" +#include "qt/callback.h" #include "qt/optionsmodel.h" #include "qt/platformstyle.h" #include "qt/qvalidatedlineedit.h" @@ -22,9 +23,7 @@ namespace //! Press "Yes" button in modal send confirmation dialog. void ConfirmSend() { - QTimer* timer = new QTimer; - timer->setSingleShot(true); - QObject::connect(timer, &QTimer::timeout, []() { + QTimer::singleShot(0, makeCallback([](Callback* callback) { for (QWidget* widget : QApplication::topLevelWidgets()) { if (widget->inherits("SendConfirmationDialog")) { SendConfirmationDialog* dialog = qobject_cast<SendConfirmationDialog*>(widget); @@ -33,8 +32,8 @@ void ConfirmSend() button->click(); } } - }); - timer->start(0); + delete callback; + }), SLOT(call())); } //! Send coins to address and return txid. |