Fix keyboard inconsistencies

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-09-23 13:56:49 -03:00 committed by Dirk Hohndel
parent 4b8eec6c58
commit 7d863b5c28
2 changed files with 4 additions and 9 deletions

View file

@ -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();
}
}

View file

@ -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;