diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/diveplanner.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 18a97567c..b0f3e901e 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -191,11 +191,18 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent) bool DivePlannerGraphics::eventFilter(QObject *object, QEvent* event) { - if (object == gasListView && event->type() == QEvent::KeyPress) { + if (object != gasListView) + return false; + if (event->type() == QEvent::KeyPress) { QKeyEvent *ke = static_cast<QKeyEvent *>(event); if (ke->key() == Qt::Key_Escape) gasListView->hide(); } + if (event->type() == QEvent::MouseButtonPress){ + QMouseEvent *me = static_cast<QMouseEvent *>(event); + if (!gasListView->geometry().contains(me->pos())) + gasListView->hide(); + } return false; } |