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>
This commit is contained in:
Grace Karanja 2015-02-06 14:19:04 +03:00 committed by Dirk Hohndel
parent c97128102d
commit 88fa627258

View file

@ -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;