qt: Remove QSignalMapper from TransactionView

The QSignalMapper class is obsolete since Qt 5.10.
This commit is contained in:
Hennadii Stepanov 2019-08-24 10:22:47 +03:00
parent 9e0c1d676c
commit 0912134039
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 3 additions and 11 deletions

View file

@ -30,7 +30,6 @@
#include <QMenu> #include <QMenu>
#include <QPoint> #include <QPoint>
#include <QScrollBar> #include <QScrollBar>
#include <QSignalMapper>
#include <QTableView> #include <QTableView>
#include <QTimer> #include <QTimer>
#include <QUrl> #include <QUrl>
@ -176,11 +175,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
contextMenu->addAction(abandonAction); contextMenu->addAction(abandonAction);
contextMenu->addAction(editLabelAction); contextMenu->addAction(editLabelAction);
mapperThirdPartyTxUrls = new QSignalMapper(this);
// Connect actions
connect(mapperThirdPartyTxUrls, static_cast<void (QSignalMapper::*)(const QString&)>(&QSignalMapper::mapped), this, &TransactionView::openThirdPartyTxUrl);
connect(dateWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseDate); connect(dateWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseDate);
connect(typeWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseType); connect(typeWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseType);
connect(watchOnlyWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseWatchonly); connect(watchOnlyWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseWatchonly);
@ -246,15 +240,15 @@ void TransactionView::setModel(WalletModel *_model)
QStringList listUrls = _model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts); QStringList listUrls = _model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts);
for (int i = 0; i < listUrls.size(); ++i) for (int i = 0; i < listUrls.size(); ++i)
{ {
QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host(); QString url = listUrls[i].trimmed();
QString host = QUrl(url, QUrl::StrictMode).host();
if (!host.isEmpty()) if (!host.isEmpty())
{ {
QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label
if (i == 0) if (i == 0)
contextMenu->addSeparator(); contextMenu->addSeparator();
contextMenu->addAction(thirdPartyTxUrlAction); contextMenu->addAction(thirdPartyTxUrlAction);
connect(thirdPartyTxUrlAction, &QAction::triggered, mapperThirdPartyTxUrls, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map)); connect(thirdPartyTxUrlAction, &QAction::triggered, [this, url] { openThirdPartyTxUrl(url); });
mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, listUrls[i].trimmed());
} }
} }
} }

View file

@ -23,7 +23,6 @@ class QFrame;
class QLineEdit; class QLineEdit;
class QMenu; class QMenu;
class QModelIndex; class QModelIndex;
class QSignalMapper;
class QTableView; class QTableView;
QT_END_NAMESPACE QT_END_NAMESPACE
@ -72,7 +71,6 @@ private:
QLineEdit *amountWidget; QLineEdit *amountWidget;
QMenu *contextMenu; QMenu *contextMenu;
QSignalMapper *mapperThirdPartyTxUrls;
QFrame *dateRangeWidget; QFrame *dateRangeWidget;
QDateTimeEdit *dateFrom; QDateTimeEdit *dateFrom;