mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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:
parent
c97128102d
commit
88fa627258
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue