diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-09-21 17:11:59 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-23 14:15:22 -0700 |
commit | 534e07399ac459a48d6e049d1ff36cef223eea66 (patch) | |
tree | 35ca156dfa484d83c8b9d43ca155dc7be8e662d6 | |
parent | fdd28fddf2303d6cf2c51383c87195af3774a91c (diff) | |
download | subsurface-534e07399ac459a48d6e049d1ff36cef223eea66.tar.gz |
Made it possible to keypress again
Click outside of the popup closes it, also handles theme
enter / return keys.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/locationinformation.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 468212c44..f8a125732 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -429,7 +429,7 @@ DiveLocationLineEdit::DiveLocationLineEdit(QWidget *parent) view->setSelectionMode(QAbstractItemView::SingleSelection); view->setParent(0, Qt::Popup); view->installEventFilter(this); - view->setFocusProxy(this); + view->setFocusProxy(location_line_edit); connect(this, &QLineEdit::textEdited, this, &DiveLocationLineEdit::setTemporaryDiveSiteName); } @@ -437,6 +437,8 @@ DiveLocationLineEdit::DiveLocationLineEdit(QWidget *parent) bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e) { if(e->type() == QEvent::KeyPress) { + if (view->focusProxy() == this) qDebug() << "Ueh..."; + else qDebug() << "Nao eh..."; QKeyEvent *keyEv = (QKeyEvent*) e; qDebug() << view->focusProxy()->objectName(); @@ -446,11 +448,21 @@ bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e) return true; } - if(keyEv->key() == Qt::Key_Return) { + if(keyEv->key() == Qt::Key_Return || keyEv->key() == Qt::Key_Enter) { view->hide(); return false; } + + event(e); + } + + if(e->type() == QEvent::MouseButtonPress ) { + if (!view->underMouse()) { + view->hide(); + return true; + } } + return false; } |