From 43524127314d1fd6526dc5c23f1c42984b4d5c1b Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 22 Sep 2015 16:27:07 -0300 Subject: Correctly handle space and tab Space and tab should select the item in the itemview and hide it; enter and return also do that automatically. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/locationinformation.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 822184473..c446cada7 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -449,10 +449,18 @@ bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e) return true; } - if(keyEv->key() == Qt::Key_Return || keyEv->key() == Qt::Key_Enter) { + if(keyEv->key() == Qt::Key_Return || + keyEv->key() == Qt::Key_Enter) { view->hide(); return false; } + + if (keyEv->key() == Qt::Key_Space || + keyEv->key() == Qt::Key_Tab){ + itemActivated(view->currentIndex()); + view->hide(); + return false; + } event(e); } else if(e->type() == QEvent::MouseButtonPress ) { if (!view->underMouse()) { @@ -560,6 +568,7 @@ void DiveLocationLineEdit::showPopup() view->setGeometry(pos.x(), pos.y(), w, h); if (!view->isVisible()) { + setTemporaryDiveSiteName(text()); proxy->invalidate(); view->show(); } -- cgit v1.2.3-70-g09d2