PIVX Core  5.6.99
P2P Digital Currency
coincontroltreewidget.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Copyright (c) 2017-2021 The PIVX Core developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
7 #include "coincontroldialog.h"
8 
9 CoinControlTreeWidget::CoinControlTreeWidget(QWidget* parent) : QTreeWidget(parent)
10 {
11 }
12 
14 {
15  if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox
16  {
17  event->ignore();
18  int COLUMN_CHECKBOX = 0;
19  if (this->currentItem())
20  this->currentItem()->setCheckState(COLUMN_CHECKBOX, ((this->currentItem()->checkState(COLUMN_CHECKBOX) == Qt::Checked) ? Qt::Unchecked : Qt::Checked));
21  } else if (event->key() == Qt::Key_Escape) // press esc -> close dialog
22  {
23  event->ignore();
24  auto* coinControlDialog = static_cast<CoinControlDialog*>(this->parentWidget()->parentWidget());
25  coinControlDialog->done(QDialog::Accepted);
26  } else {
27  this->QTreeWidget::keyPressEvent(event);
28  }
29 }
virtual void keyPressEvent(QKeyEvent *event)
CoinControlTreeWidget(QWidget *parent=0)