From 437469e8ff349599cfdac243ad2d8a59ab6da6a2 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 5 Oct 2015 18:01:28 -0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/locationinformation.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 4c11326f3..5807266fd 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -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 -- cgit v1.2.3-70-g09d2