From 7d863b5c280c12d657fa46f909965071d5649ac5 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 23 Sep 2015 13:56:49 -0300 Subject: [PATCH] Fix keyboard inconsistencies Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/locationinformation.cpp | 12 ++++-------- qt-ui/locationinformation.h | 1 - 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index bb07303dd..2f4b8afda 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -433,15 +433,9 @@ DiveLocationLineEdit::DiveLocationLineEdit(QWidget *parent) : QLineEdit(parent), view->setFocusProxy(this); connect(this, &QLineEdit::textEdited, this, &DiveLocationLineEdit::setTemporaryDiveSiteName); - connect(this, &QLineEdit::editingFinished, this, &DiveLocationLineEdit::setDiveSiteName); connect(view, &QAbstractItemView::activated, this, &DiveLocationLineEdit::itemActivated); } -void DiveLocationLineEdit::setDiveSiteName() -{ - -} - bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e) { if(e->type() == QEvent::KeyPress) { @@ -458,8 +452,7 @@ bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e) return false; } - if (keyEv->key() == Qt::Key_Space || - keyEv->key() == Qt::Key_Tab){ + if (keyEv->key() == Qt::Key_Tab){ itemActivated(view->currentIndex()); view->hide(); return false; @@ -493,6 +486,8 @@ void DiveLocationLineEdit::itemActivated(const QModelIndex& index) qDebug() << "Setting a New dive site"; else qDebug() << "Setting a Existing dive site"; + if(view->isVisible()) + view->hide(); } void DiveLocationLineEdit::refreshDiveSiteCache() @@ -585,6 +580,7 @@ void DiveLocationLineEdit::showPopup() if (!view->isVisible()) { setTemporaryDiveSiteName(text()); proxy->invalidate(); + view->setCurrentIndex( view->model()->index(0,1)); view->show(); } } diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h index 2b41f5276..5085f83a2 100644 --- a/qt-ui/locationinformation.h +++ b/qt-ui/locationinformation.h @@ -96,7 +96,6 @@ public: void setTemporaryDiveSiteName(const QString& s); bool eventFilter(QObject*, QEvent*); void itemActivated(const QModelIndex& index); - void setDiveSiteName(); DiveSiteType currDiveSiteType() const; uint32_t currDiveSiteUuid() const;