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