summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-19 10:30:36 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-19 10:31:01 -0700
commit138a00bd102883551442fb42d0cb26467e82bbe0 (patch)
treece4b85dbea7e11fab2cc12248eac85d7a80d9046 /qt-ui/models.cpp
parent07a16574e9263fc2e30a7c0aec18df33d54a70dc (diff)
downloadsubsurface-138a00bd102883551442fb42d0cb26467e82bbe0.tar.gz
Improve readability of yearly statistics
Make the entries for years bold, keep the months non-bold. It's still a sea of data, but this is an improvement. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r--qt-ui/models.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index f4be58fa7..bd25ff268 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -822,12 +822,13 @@ QVariant TreeModel::data(const QModelIndex& index, int role) const
if (!index.isValid())
return QVariant();
- if (role == Qt::FontRole) {
- return defaultModelFont();
- }
TreeItem* item = static_cast<TreeItem*>(index.internalPointer());
+ QVariant val = item->data(index.column(), role);
- return item->data(index.column(), role);
+ if (role == Qt::FontRole && !val.isValid())
+ return defaultModelFont();
+ else
+ return val;
}
QModelIndex TreeModel::index(int row, int column, const QModelIndex& parent)
@@ -1309,9 +1310,14 @@ QVariant YearStatisticsItem::data(int column, int role) const
{
double value;
QVariant ret;
- if (role != Qt::DisplayRole)
- return ret;
+ if (role == Qt::FontRole) {
+ QFont font = defaultModelFont();
+ font.setBold(stats_interval.is_year);
+ return font;
+ } else if (role != Qt::DisplayRole) {
+ return ret;
+ }
switch(column) {
case YEAR: ret = stats_interval.period; break;
case DIVES: ret = stats_interval.selection_size; break;