summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-14 15:20:11 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-15 09:16:22 +0900
commitb77d990ed6892081f7c1e0df62631b57aad3b59f (patch)
tree8d54f206b8b3704445919ba2e2c63cd52efd572c /qt-ui/diveplanner.cpp
parenta6615f67cd06a3a4211e0f0fa167d532b4aad706 (diff)
downloadsubsurface-b77d990ed6892081f7c1e0df62631b57aad3b59f.tar.gz
Close the Air list when clicking outside of it.
This patch closes the air list when clicing outside of it, making the use of the planner more pleasant. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp9
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;
}