contacts: double click to pay to

This commit is contained in:
tobtoht 2021-06-04 20:32:18 +02:00
parent e2a591baed
commit e8057fc35d

View file

@ -36,6 +36,12 @@ ContactsWidget::ContactsWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
connect(ui->contacts->header(), &QHeaderView::customContextMenuRequested, this, &ContactsWidget::showHeaderMenu); 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 // context menu
ui->contacts->setContextMenuPolicy(Qt::CustomContextMenu); ui->contacts->setContextMenuPolicy(Qt::CustomContextMenu);
m_contextMenu = new QMenu(ui->contacts); m_contextMenu = new QMenu(ui->contacts);
@ -45,8 +51,7 @@ ContactsWidget::ContactsWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
// row context menu // row context menu
m_rowMenu = new QMenu(ui->contacts); m_rowMenu = new QMenu(ui->contacts);
m_rowMenu->addAction(icons()->icon("copy.png"), "Copy address", this, &ContactsWidget::copyAddress); m_rowMenu->addAction("Copy address", this, &ContactsWidget::copyAddress);
m_rowMenu->addAction(icons()->icon("copy.png"), "Copy name", this, &ContactsWidget::copyName);
m_rowMenu->addAction("Pay to", this, &ContactsWidget::payTo); m_rowMenu->addAction("Pay to", this, &ContactsWidget::payTo);
m_rowMenu->addAction("Delete", this, &ContactsWidget::deleteContact); m_rowMenu->addAction("Delete", this, &ContactsWidget::deleteContact);