diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-08-29 15:57:36 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-08-29 15:59:29 +0200 |
commit | 75142ece6b6624bcc1c480d170b92ed07359fd4c (patch) | |
tree | fda2cdab222506fb7e46499e1155633f23e63cf8 /src/qt/rpcconsole.cpp | |
parent | 1f8378508acfc1f6ca48dcc75eb0848e82bb183d (diff) | |
parent | 091213403922e970b38cc3a98c11074e02ddba14 (diff) |
Merge #16706: qt: Replace deprecated QSignalMapper by lambda expressions
091213403922e970b38cc3a98c11074e02ddba14 qt: Remove QSignalMapper from TransactionView (Hennadii Stepanov)
9e0c1d676c5892fb5bd8fe98781915506a25108f qt: Remove QSignalMapper from RPCConsole (Hennadii Stepanov)
Pull request description:
The [`QSignalMapper`](https://doc.qt.io/qt-5/qsignalmapper.html) class has been [deprecated](https://doc-snapshots.qt.io/qt5-5.10/obsoleteclasses.html) since Qt 5.10.
This PR replaces it by lambdas and does not change behavior.
ACKs for top commit:
jonasschnelli:
utACK 091213403922e970b38cc3a98c11074e02ddba14
Tree-SHA512: 0c102d5cab4adc8b6252f72e07123ac87c65434c88cada3e72816ecea8fc4803f15b9c050fb5e1c7e8a96f709265521fd6813ab1890dbf5634032f7ee0d50675
Diffstat (limited to 'src/qt/rpcconsole.cpp')
-rw-r--r-- | src/qt/rpcconsole.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 8a3671dc54..eccc34e12f 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -34,7 +34,6 @@ #include <QScrollBar> #include <QScreen> #include <QSettings> -#include <QSignalMapper> #include <QTime> #include <QTimer> #include <QStringList> @@ -614,19 +613,10 @@ void RPCConsole::setClientModel(ClientModel *model) peersTableContextMenu->addAction(banAction7d); peersTableContextMenu->addAction(banAction365d); - // Add a signal mapping to allow dynamic context menu arguments. - // We need to use int (instead of int64_t), because signal mapper only supports - // int or objects, which is okay because max bantime (1 year) is < int_max. - QSignalMapper* signalMapper = new QSignalMapper(this); - signalMapper->setMapping(banAction1h, 60*60); - signalMapper->setMapping(banAction24h, 60*60*24); - signalMapper->setMapping(banAction7d, 60*60*24*7); - signalMapper->setMapping(banAction365d, 60*60*24*365); - connect(banAction1h, &QAction::triggered, signalMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map)); - connect(banAction24h, &QAction::triggered, signalMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map)); - connect(banAction7d, &QAction::triggered, signalMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map)); - connect(banAction365d, &QAction::triggered, signalMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map)); - connect(signalMapper, static_cast<void (QSignalMapper::*)(int)>(&QSignalMapper::mapped), this, &RPCConsole::banSelectedNode); + connect(banAction1h, &QAction::triggered, [this] { banSelectedNode(60 * 60); }); + connect(banAction24h, &QAction::triggered, [this] { banSelectedNode(60 * 60 * 24); }); + connect(banAction7d, &QAction::triggered, [this] { banSelectedNode(60 * 60 * 24 * 7); }); + connect(banAction365d, &QAction::triggered, [this] { banSelectedNode(60 * 60 * 24 * 365); }); // peer table context menu signals connect(ui->peerWidget, &QTableView::customContextMenuRequested, this, &RPCConsole::showPeersTableContextMenu); |