Skip to content

Commit 0912134

Browse files
committed
qt: Remove QSignalMapper from TransactionView
The QSignalMapper class is obsolete since Qt 5.10.
1 parent 9e0c1d6 commit 0912134

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/qt/transactionview.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <QMenu>
3131
#include <QPoint>
3232
#include <QScrollBar>
33-
#include <QSignalMapper>
3433
#include <QTableView>
3534
#include <QTimer>
3635
#include <QUrl>
@@ -176,11 +175,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
176175
contextMenu->addAction(abandonAction);
177176
contextMenu->addAction(editLabelAction);
178177

179-
mapperThirdPartyTxUrls = new QSignalMapper(this);
180-
181-
// Connect actions
182-
connect(mapperThirdPartyTxUrls, static_cast<void (QSignalMapper::*)(const QString&)>(&QSignalMapper::mapped), this, &TransactionView::openThirdPartyTxUrl);
183-
184178
connect(dateWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseDate);
185179
connect(typeWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseType);
186180
connect(watchOnlyWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseWatchonly);
@@ -246,15 +240,15 @@ void TransactionView::setModel(WalletModel *_model)
246240
QStringList listUrls = _model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts);
247241
for (int i = 0; i < listUrls.size(); ++i)
248242
{
249-
QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host();
243+
QString url = listUrls[i].trimmed();
244+
QString host = QUrl(url, QUrl::StrictMode).host();
250245
if (!host.isEmpty())
251246
{
252247
QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label
253248
if (i == 0)
254249
contextMenu->addSeparator();
255250
contextMenu->addAction(thirdPartyTxUrlAction);
256-
connect(thirdPartyTxUrlAction, &QAction::triggered, mapperThirdPartyTxUrls, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
257-
mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, listUrls[i].trimmed());
251+
connect(thirdPartyTxUrlAction, &QAction::triggered, [this, url] { openThirdPartyTxUrl(url); });
258252
}
259253
}
260254
}

src/qt/transactionview.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class QFrame;
2323
class QLineEdit;
2424
class QMenu;
2525
class QModelIndex;
26-
class QSignalMapper;
2726
class QTableView;
2827
QT_END_NAMESPACE
2928

@@ -72,7 +71,6 @@ class TransactionView : public QWidget
7271
QLineEdit *amountWidget;
7372

7473
QMenu *contextMenu;
75-
QSignalMapper *mapperThirdPartyTxUrls;
7674

7775
QFrame *dateRangeWidget;
7876
QDateTimeEdit *dateFrom;

0 commit comments

Comments
 (0)