qt, refactor: simplify third-party tx url action through overload

Simplify the creation, addition, and slot/signal connection of
a third part tx url context menu action by using an overloaded
addAction function.
This commit is contained in:
Jarol Rodriguez 2021-09-23 03:17:47 -04:00
parent 971cad475f
commit 9980f4aa5e

View File

@ -228,11 +228,9 @@ void TransactionView::setModel(WalletModel *_model)
QString host = QUrl(url, QUrl::StrictMode).host();
if (!host.isEmpty())
{
QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label
if (i == 0)
contextMenu->addSeparator();
contextMenu->addAction(thirdPartyTxUrlAction);
connect(thirdPartyTxUrlAction, &QAction::triggered, [this, url] { openThirdPartyTxUrl(url); });
contextMenu->addAction(host, [this, url] { openThirdPartyTxUrl(url); });
}
}
}