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(event); if (ke->key() == Qt::Key_Escape) gasListView->hide(); } + if (event->type() == QEvent::MouseButtonPress){ + QMouseEvent *me = static_cast(event); + if (!gasListView->geometry().contains(me->pos())) + gasListView->hide(); + } return false; }