mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile/summary: add section headers
Add section headers to the dive summaries on mobile by adding a section-property. Of course, this will not work on desktop. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1809dbd00a
commit
a93c303b8b
3 changed files with 28 additions and 1 deletions
|
@ -20,7 +20,8 @@ QHash<int, QByteArray> DiveSummaryModel::roleNames() const
|
|||
{
|
||||
return { { HEADER_ROLE, "header" },
|
||||
{ COLUMN0_ROLE, "col0" },
|
||||
{ COLUMN1_ROLE, "col1" } };
|
||||
{ COLUMN1_ROLE, "col1" },
|
||||
{ SECTION_ROLE, "section" } };
|
||||
}
|
||||
|
||||
QVariant DiveSummaryModel::dataDisplay(int row, int col) const
|
||||
|
@ -61,6 +62,14 @@ QVariant DiveSummaryModel::data(const QModelIndex &index, int role) const
|
|||
return dataDisplay(row, 0);
|
||||
case COLUMN1_ROLE:
|
||||
return dataDisplay(row, 1);
|
||||
case SECTION_ROLE:
|
||||
switch (row) {
|
||||
case DIVES ... PLANS: return tr("Number of dives");
|
||||
case TIME ... TIME_AVG: return tr("Time");
|
||||
case DEPTH_MAX ... DEPTH_AVG: return tr("Depth");
|
||||
case SAC_MIN ... SAC_AVG: return tr("SAC");
|
||||
default: return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
// The unsupported case
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue