| 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 | if (this->currentItem()) { |
| 20 | int COLUMN_CHECKBOX = 0; |
| 21 | this->currentItem()->setCheckState(COLUMN_CHECKBOX, ((this->currentItem()->checkState(COLUMN_CHECKBOX) == Qt::Checked) ? Qt::Unchecked : Qt::Checked)); |
| 22 | } |
| 23 | } |
| 24 | else if (event->key() == Qt::Key_Escape) // press esc -> close dialog |
| 25 | { |
| 26 | event->ignore(); |
| 27 | CoinControlDialog *coinControlDialog = static_cast<CoinControlDialog*>(this->parentWidget()); |
| 28 | coinControlDialog->done(QDialog::Accepted); |
| 29 | } |
| 30 | else |
| 31 | { |
| 32 | this->QTreeWidget::keyPressEvent(event); |
| 33 | } |
| 34 | } |