From 1cdd9fbdf5c0b732236d3b2dc164b2c7a6b1b188 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Sat, 13 Jul 2024 12:52:14 +0700 Subject: [PATCH] refactor: use new QAction style for governance list and masternode list --- src/qt/governancelist.cpp | 6 ++---- src/qt/masternodelist.cpp | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/qt/governancelist.cpp b/src/qt/governancelist.cpp index 57fd41153e..807157d8b6 100644 --- a/src/qt/governancelist.cpp +++ b/src/qt/governancelist.cpp @@ -387,14 +387,12 @@ void GovernanceList::showProposalContextMenu(const QPoint& pos) return; } + // right click menu with option to open proposal url QString proposal_url = proposal->url(); proposal_url.replace(QChar('&'), QString("&&")); - // right click menu with option to open proposal url - QAction* openProposalUrl = new QAction(proposal_url, this); proposalContextMenu->clear(); - proposalContextMenu->addAction(openProposalUrl); - connect(openProposalUrl, &QAction::triggered, proposal, &Proposal::openUrl); + proposalContextMenu->addAction(proposal_url, proposal, &Proposal::openUrl); proposalContextMenu->exec(QCursor::pos()); } diff --git a/src/qt/masternodelist.cpp b/src/qt/masternodelist.cpp index 43ba572455..7b8cdb7fe1 100644 --- a/src/qt/masternodelist.cpp +++ b/src/qt/masternodelist.cpp @@ -81,15 +81,12 @@ MasternodeList::MasternodeList(QWidget* parent) : ui->checkBoxMyMasternodesOnly->setEnabled(false); - QAction* copyProTxHashAction = new QAction(tr("Copy ProTx Hash"), this); - QAction* copyCollateralOutpointAction = new QAction(tr("Copy Collateral Outpoint"), this); contextMenuDIP3 = new QMenu(this); - contextMenuDIP3->addAction(copyProTxHashAction); - contextMenuDIP3->addAction(copyCollateralOutpointAction); + contextMenuDIP3->addAction(tr("Copy ProTx Hash"), this, &MasternodeList::copyProTxHash_clicked); + contextMenuDIP3->addAction(tr("Copy Collateral Outpoint"), this, &MasternodeList::copyCollateralOutpoint_clicked); + connect(ui->tableWidgetMasternodesDIP3, &QTableWidget::customContextMenuRequested, this, &MasternodeList::showContextMenuDIP3); connect(ui->tableWidgetMasternodesDIP3, &QTableWidget::doubleClicked, this, &MasternodeList::extraInfoDIP3_clicked); - connect(copyProTxHashAction, &QAction::triggered, this, &MasternodeList::copyProTxHash_clicked); - connect(copyCollateralOutpointAction, &QAction::triggered, this, &MasternodeList::copyCollateralOutpoint_clicked); timer = new QTimer(this); connect(timer, &QTimer::timeout, this, &MasternodeList::updateDIP3ListScheduled);