From 4b8eec6c580dd33278bd6487a88575ad39b40378 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 22 Sep 2015 17:20:55 -0300 Subject: Fix new/existing dive site choices Only set the currType and currUuid if text changed. This is needed because if you hit key_down it would set NEW_DIVE_SITE because a keypress on the lineedit was due. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/locationinformation.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 206b6eccf..bb07303dd 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -489,6 +489,10 @@ void DiveLocationLineEdit::itemActivated(const QModelIndex& index) currType = uuid == 1 ? NEW_DIVE_SITE : EXISTING_DIVE_SITE; currUuid = uuid; setText(index.data().toString()); + if(currUuid == NEW_DIVE_SITE) + qDebug() << "Setting a New dive site"; + else + qDebug() << "Setting a Existing dive site"; } void DiveLocationLineEdit::refreshDiveSiteCache() @@ -533,6 +537,11 @@ void DiveLocationLineEdit::keyPressEvent(QKeyEvent *ev) ev->key() != Qt::Key_Right && ev->key() != Qt::Key_Escape && ev->key() != Qt::Key_Return ) { + + if(ev->key() != Qt::Key_Up && ev->key() != Qt::Key_Down) { + currType = NEW_DIVE_SITE; + currUuid = RECENTLY_ADDED_DIVESITE; + } showPopup(); } else if (ev->key() == Qt::Key_Escape) { view->hide(); -- cgit v1.2.3-70-g09d2