aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-09-23 13:56:49 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-23 14:15:23 -0700
commit7d863b5c280c12d657fa46f909965071d5649ac5 (patch)
tree7a708a2569b172fe3840ab3b1734f4ef859dcaba /qt-ui
parent4b8eec6c580dd33278bd6487a88575ad39b40378 (diff)
downloadsubsurface-7d863b5c280c12d657fa46f909965071d5649ac5.tar.gz
Fix keyboard inconsistencies
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/locationinformation.cpp12
-rw-r--r--qt-ui/locationinformation.h1
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;