From 16c157de3c316517e095994fa8d526253225a672 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 30 Mar 2021 02:49:03 +0300 Subject: qt, refactor: Use better QMenu::addAction overloaded function This overloaded function was introduced in Qt 5.6 and makes code more concise. --- src/qt/receivecoinsdialog.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'src/qt/receivecoinsdialog.cpp') diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 61cb89d75a..3f4d7f85e6 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -42,28 +42,14 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid ui->removeRequestButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove")); } - // context menu actions - QAction *copyURIAction = new QAction(tr("Copy URI"), this); - QAction* copyAddressAction = new QAction(tr("Copy address"), this); - copyLabelAction = new QAction(tr("Copy label"), this); - copyMessageAction = new QAction(tr("Copy message"), this); - copyAmountAction = new QAction(tr("Copy amount"), this); - // context menu contextMenu = new QMenu(this); - contextMenu->addAction(copyURIAction); - contextMenu->addAction(copyAddressAction); - contextMenu->addAction(copyLabelAction); - contextMenu->addAction(copyMessageAction); - contextMenu->addAction(copyAmountAction); - - // context menu signals + contextMenu->addAction(tr("Copy URI"), this, &ReceiveCoinsDialog::copyURI); + contextMenu->addAction(tr("Copy address"), this, &ReceiveCoinsDialog::copyAddress); + copyLabelAction = contextMenu->addAction(tr("Copy label"), this, &ReceiveCoinsDialog::copyLabel); + copyMessageAction = contextMenu->addAction(tr("Copy message"), this, &ReceiveCoinsDialog::copyMessage); + copyAmountAction = contextMenu->addAction(tr("Copy amount"), this, &ReceiveCoinsDialog::copyAmount); connect(ui->recentRequestsView, &QWidget::customContextMenuRequested, this, &ReceiveCoinsDialog::showMenu); - connect(copyURIAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyURI); - connect(copyAddressAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyAddress); - connect(copyLabelAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyLabel); - connect(copyMessageAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyMessage); - connect(copyAmountAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyAmount); connect(ui->clearButton, &QPushButton::clicked, this, &ReceiveCoinsDialog::clear); -- cgit v1.2.3