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:
parent
33a19328d8
commit
4352412731
@ -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();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user