aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-07-08 11:09:51 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-08 07:50:09 -0700
commit2f9e859615b462a195ccbbe67c67f6ae05367fe6 (patch)
tree4d500485e7cfa87cd4d3a07ad82269276a349db2 /qt-ui
parent967bd68e6499b133264372ca5c81a9320a79e6c0 (diff)
downloadsubsurface-2f9e859615b462a195ccbbe67c67f6ae05367fe6.tar.gz
Use taxonomy or coords on the delegate
The Taxonomy text should be used if there's a taxonomy for the dive site. If there isn't, then use coords. If there's none, then nothing will appear on the bottom of the dive site name. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/modeldelegates.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index 0399722ba..423eea3e3 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -502,9 +502,20 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem
if (!ds)
return;
- const char *gpsCoords = printGPSCoords(displayed_dive_site.latitude.udeg, displayed_dive_site.longitude.udeg);
- QString diveSiteCoords(gpsCoords);
- free( (void*) gpsCoords);
+ QString bottomText;
+ for (int i = 0; i < ds->taxonomy.nr; i++) {
+ if(ds->taxonomy.category[i].category == TC_NONE)
+ continue;
+ if(!bottomText.isEmpty())
+ bottomText += " ";
+ bottomText += QString(ds->taxonomy.category[i].value) + " ";
+ }
+
+ if (bottomText.isEmpty()) {
+ const char *gpsCoords = printGPSCoords(displayed_dive_site.latitude.udeg, displayed_dive_site.longitude.udeg);
+ bottomText = QString(gpsCoords);
+ free( (void*) gpsCoords);
+ }
fontBigger.setPointSize(fontBigger.pointSize() + 1);
fontBigger.setBold(true);
@@ -526,7 +537,7 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem
painter->drawText(option.rect.x(),option.rect.y() + fmBigger.boundingRect("YH").height(), diveSiteName);
painter->setFont(fontSmaller);
painter->setBrush(option.palette.brightText());
- painter->drawText(option.rect.x(),option.rect.y() + fmBigger.boundingRect("YH").height() * 2, diveSiteCoords);
+ painter->drawText(option.rect.x(),option.rect.y() + fmBigger.boundingRect("YH").height() * 2, bottomText);
painter->restore();
}