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:
committed by
Dirk Hohndel
parent
c97128102d
commit
88fa627258
@@ -84,6 +84,8 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec
|
|||||||
|
|
||||||
|
|
||||||
header()->setStretchLastSection(true);
|
header()->setStretchLastSection(true);
|
||||||
|
|
||||||
|
installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveListView::~DiveListView()
|
DiveListView::~DiveListView()
|
||||||
@@ -343,6 +345,10 @@ bool DiveListView::eventFilter(QObject *, QEvent *event)
|
|||||||
if (event->type() != QEvent::KeyPress)
|
if (event->type() != QEvent::KeyPress)
|
||||||
return false;
|
return false;
|
||||||
QKeyEvent *keyEv = static_cast<QKeyEvent *>(event);
|
QKeyEvent *keyEv = static_cast<QKeyEvent *>(event);
|
||||||
|
if (keyEv->key() == Qt::Key_Delete) {
|
||||||
|
contextMenuIndex = currentIndex();
|
||||||
|
deleteDive();
|
||||||
|
}
|
||||||
if (keyEv->key() != Qt::Key_Escape)
|
if (keyEv->key() != Qt::Key_Escape)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user