aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-09-22 16:36:17 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-23 14:15:23 -0700
commit80b42bd28bc9d98dc9f645a4f6e56c224ee855b2 (patch)
tree2df61da73c503de7f4836f38733546dc6c1abb1d
parent43524127314d1fd6526dc5c23f1c42984b4d5c1b (diff)
downloadsubsurface-80b42bd28bc9d98dc9f645a4f6e56c224ee855b2.tar.gz
Set the current dive site uid / text
Start to make this thing usefull: Upon selecting the current index or writting something on the line edit, we need to set the dive site. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/locationinformation.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index c446cada7..206b6eccf 100644
--- a/qt-ui/locationinformation.cpp
+++ b/qt-ui/locationinformation.cpp
@@ -357,6 +357,9 @@ void DiveLocationModel::resetModel()
QVariant DiveLocationModel::data(const QModelIndex& index, int role) const
{
if(index.row() <= 1) { // two special cases.
+ if(index.column() == UUID) {
+ return RECENTLY_ADDED_DIVESITE;
+ }
switch(role) {
case Qt::DisplayRole : return new_ds_value[index.row()];
case Qt::ToolTipRole : return "Create a new dive site";
@@ -475,14 +478,17 @@ bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e)
void DiveLocationLineEdit::focusOutEvent(QFocusEvent* ev)
{
if (!view->isVisible()) {
- qDebug() << "Focusing Out";
QLineEdit::focusOutEvent(ev);
}
}
void DiveLocationLineEdit::itemActivated(const QModelIndex& index)
{
- qDebug() << "Activated" << index.data();
+ 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());
}
void DiveLocationLineEdit::refreshDiveSiteCache()