mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
a6615f67cd
commit
b77d990ed6
1 changed files with 8 additions and 1 deletions
|
@ -191,11 +191,18 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
|
||||||
|
|
||||||
bool DivePlannerGraphics::eventFilter(QObject *object, QEvent* event)
|
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);
|
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||||
if (ke->key() == Qt::Key_Escape)
|
if (ke->key() == Qt::Key_Escape)
|
||||||
gasListView->hide();
|
gasListView->hide();
|
||||||
}
|
}
|
||||||
|
if (event->type() == QEvent::MouseButtonPress){
|
||||||
|
QMouseEvent *me = static_cast<QMouseEvent *>(event);
|
||||||
|
if (!gasListView->geometry().contains(me->pos()))
|
||||||
|
gasListView->hide();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue