summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-21 08:50:09 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-21 08:50:09 -0700
commit5e6ed53e40a6bedf5c88f175b27d809c7fdffaea (patch)
tree5feb7ac24267d71c9a931269b0cca04e39b4226f /qt-ui/diveplanner.cpp
parenta8888eaf26c9355f3f2d20c24526489e17d3404a (diff)
downloadsubsurface-5e6ed53e40a6bedf5c88f175b27d809c7fdffaea.tar.gz
In planner / add dive use 'ESC' to hide the gas selection popup
Not sure if there are other keys we should support. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index c5649e19e..7832d19cd 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -164,6 +164,7 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
gasListView->setWindowFlags(Qt::Popup);
gasListView->setModel(airTypes());
gasListView->hide();
+ gasListView->installEventFilter(this);
connect(gasListView, SIGNAL(activated(QModelIndex)), this, SLOT(selectGas(QModelIndex)));
connect(plannerModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(drawProfile()));
@@ -175,6 +176,16 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
setRenderHint(QPainter::Antialiasing);
}
+bool DivePlannerGraphics::eventFilter(QObject *object, QEvent* event)
+{
+ if (object == gasListView && event->type() == QEvent::KeyPress) {
+ QKeyEvent *ke = static_cast<QKeyEvent *>(event);
+ if (ke->key() == Qt::Key_Escape)
+ gasListView->hide();
+ }
+ return false;
+}
+
void DivePlannerGraphics::pointInserted(const QModelIndex& parent, int start , int end)
{
DiveHandler *item = new DiveHandler ();