Do not incorrectly use the UUID as the dive name

for some reason sometimes activating the dive via tab
or enter gave us the wrong column, so simply select the
right one.

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-10-05 18:01:28 -03:00 committed by Dirk Hohndel
parent 3c2965b151
commit 437469e8ff

View file

@ -447,11 +447,15 @@ void DiveLocationLineEdit::focusOutEvent(QFocusEvent *ev)
void DiveLocationLineEdit::itemActivated(const QModelIndex &index)
{
QModelIndex idx = index;
if (index.column() == DiveLocationModel::UUID)
idx = index.model()->index(index.row(), DiveLocationModel::NAME);
QModelIndex uuidIndex = index.model()->index(index.row(), DiveLocationModel::UUID);
uint32_t uuid = uuidIndex.data().toInt();
currType = uuid == 1 ? NEW_DIVE_SITE : EXISTING_DIVE_SITE;
currUuid = uuid;
setText(index.data().toString());
setText(idx.data().toString());
if (currUuid == NEW_DIVE_SITE)
qDebug() << "Setting a New dive site";
else