]>
Commit | Line | Data |
---|---|---|
f914f1a7 | 1 | // Copyright (c) 2011-2013 The Bitcoin Core developers |
78253fcb | 2 | // Distributed under the MIT software license, see the accompanying |
0689f46c PK |
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
4 | ||
6a86c24d CL |
5 | #include "coincontroltreewidget.h" |
6 | #include "coincontroldialog.h" | |
7 | ||
8 | CoinControlTreeWidget::CoinControlTreeWidget(QWidget *parent) : | |
9 | QTreeWidget(parent) | |
10 | { | |
11 | ||
12 | } | |
13 | ||
14 | void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event) | |
15 | { | |
16 | if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox | |
17 | { | |
18 | event->ignore(); | |
19 | int COLUMN_CHECKBOX = 0; | |
0eade74c | 20 | if(this->currentItem()) |
21 | this->currentItem()->setCheckState(COLUMN_CHECKBOX, ((this->currentItem()->checkState(COLUMN_CHECKBOX) == Qt::Checked) ? Qt::Unchecked : Qt::Checked)); | |
6a86c24d CL |
22 | } |
23 | else if (event->key() == Qt::Key_Escape) // press esc -> close dialog | |
24 | { | |
25 | event->ignore(); | |
26 | CoinControlDialog *coinControlDialog = (CoinControlDialog*)this->parentWidget(); | |
27 | coinControlDialog->done(QDialog::Accepted); | |
28 | } | |
29 | else | |
30 | { | |
31 | this->QTreeWidget::keyPressEvent(event); | |
32 | } | |
0eade74c | 33 | } |