From e8057fc35d6039fd586a3307e0aed9b772e3ca8a Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 4 Jun 2021 20:32:18 +0200 Subject: [PATCH] contacts: double click to pay to --- src/ContactsWidget.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ContactsWidget.cpp b/src/ContactsWidget.cpp index a4616e0..b535e3c 100644 --- a/src/ContactsWidget.cpp +++ b/src/ContactsWidget.cpp @@ -36,6 +36,12 @@ ContactsWidget::ContactsWidget(QSharedPointer ctx, QWidget *parent) connect(ui->contacts->header(), &QHeaderView::customContextMenuRequested, this, &ContactsWidget::showHeaderMenu); + connect(ui->contacts, &QTreeView::doubleClicked, [this](QModelIndex index){ + if (!(m_model->flags(index) & Qt::ItemIsEditable)) { + this->payTo(); + } + }); + // context menu ui->contacts->setContextMenuPolicy(Qt::CustomContextMenu); m_contextMenu = new QMenu(ui->contacts); @@ -45,8 +51,7 @@ ContactsWidget::ContactsWidget(QSharedPointer ctx, QWidget *parent) // row context menu m_rowMenu = new QMenu(ui->contacts); - m_rowMenu->addAction(icons()->icon("copy.png"), "Copy address", this, &ContactsWidget::copyAddress); - m_rowMenu->addAction(icons()->icon("copy.png"), "Copy name", this, &ContactsWidget::copyName); + m_rowMenu->addAction("Copy address", this, &ContactsWidget::copyAddress); m_rowMenu->addAction("Pay to", this, &ContactsWidget::payTo); m_rowMenu->addAction("Delete", this, &ContactsWidget::deleteContact);