qt: Remove QSignalMapper from RPCConsole
The QSignalMapper class is obsolete since Qt 5.10.
This commit is contained in:
parent
3ca514ddb7
commit
9e0c1d676c
1 changed files with 4 additions and 14 deletions
|
@ -34,7 +34,6 @@
|
|||
#include <QMessageBox>
|
||||
#include <QScrollBar>
|
||||
#include <QSettings>
|
||||
#include <QSignalMapper>
|
||||
#include <QTime>
|
||||
#include <QTimer>
|
||||
#include <QStringList>
|
||||
|
@ -603,19 +602,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);
|
||||
|
|
Loading…
Reference in a new issue