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 <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-09-22 16:27:07 -03:00 committed by Dirk Hohndel
parent 33a19328d8
commit 4352412731

View file

@ -449,7 +449,15 @@ bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e)
return true; 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(); view->hide();
return false; return false;
} }
@ -560,6 +568,7 @@ void DiveLocationLineEdit::showPopup()
view->setGeometry(pos.x(), pos.y(), w, h); view->setGeometry(pos.x(), pos.y(), w, h);
if (!view->isVisible()) { if (!view->isVisible()) {
setTemporaryDiveSiteName(text());
proxy->invalidate(); proxy->invalidate();
view->show(); view->show();
} }