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
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user