diff options
author | Grace Karanja <gracie.karanja89@gmail.com> | 2015-02-06 14:19:04 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-02-06 07:22:50 -0800 |
commit | 88fa6272582e82825a9ce48319661c4301653db3 (patch) | |
tree | 2a0b156011a360adc5a30793ba0ab4c1702fbc1e | |
parent | c97128102d22f67e35d0057168900ffb88ec4248 (diff) | |
download | subsurface-88fa6272582e82825a9ce48319661c4301653db3.tar.gz |
Delete dives using delete key
Allow users to delete dives using the delete key.
[Dirk Hohndel: small whitespace fix; removed an unnecessary
include file]
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/divelistview.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index d4e744237..ec54af906 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -84,6 +84,8 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec header()->setStretchLastSection(true); + + installEventFilter(this); } DiveListView::~DiveListView() @@ -343,6 +345,10 @@ bool DiveListView::eventFilter(QObject *, QEvent *event) if (event->type() != QEvent::KeyPress) return false; QKeyEvent *keyEv = static_cast<QKeyEvent *>(event); + if (keyEv->key() == Qt::Key_Delete) { + contextMenuIndex = currentIndex(); + deleteDive(); + } if (keyEv->key() != Qt::Key_Escape) return false; return true; |