Fix location edit UI issue on Mac

For some reason the Mac doesn't create an "activated" signal when hitting
enter/return on the drop down. So we simply manually send this and now you can
select the site with enter/return just like on Linux or Windows.

Fixes #953

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-10-25 10:38:16 +09:00
parent bf2df951e6
commit 1ff309c9a1

View file

@ -425,6 +425,12 @@ bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e)
if (keyEv->key() == Qt::Key_Return ||
keyEv->key() == Qt::Key_Enter) {
#if __APPLE__
// for some reason it seems like on a Mac hitting return/enter
// doesn't call 'activated' for that index. so let's do it manually
if (view->currentIndex().isValid())
itemActivated(view->currentIndex());
#endif
view->hide();
return false;
}