diff options
-rw-r--r-- | qt-ui/models.cpp | 18 | ||||
-rw-r--r-- | statistics.c | 2 | ||||
-rw-r--r-- | statistics.h | 1 |
3 files changed, 15 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; diff --git a/statistics.c b/statistics.c index ece5419d9..1b6a709a6 100644 --- a/statistics.c +++ b/statistics.c @@ -128,6 +128,7 @@ void process_all_dives(struct dive *dive, struct dive **prev_dive) return; memset(stats_yearly, 0, size); memset(stats_monthly, 0, size); + stats_yearly[0].is_year = TRUE; /* this relies on the fact that the dives in the dive_table * are in chronological order */ @@ -148,6 +149,7 @@ void process_all_dives(struct dive *dive, struct dive **prev_dive) if (current_year != tm.tm_year + 1900) { current_year = tm.tm_year + 1900; process_dive(dp, &(stats_yearly[++year_iter])); + stats_yearly[year_iter].is_year = TRUE; } else { process_dive(dp, &(stats_yearly[year_iter])); } diff --git a/statistics.h b/statistics.h index ada660244..d5d373df0 100644 --- a/statistics.h +++ b/statistics.h @@ -30,6 +30,7 @@ typedef struct { unsigned int combined_count; unsigned int selection_size; unsigned int total_sac_time; + bool is_year; } stats_t; extern stats_t stats_selection; extern stats_t *stats_yearly; |