diff options
| author | 2015-01-08 10:25:38 -0200 | |
|---|---|---|
| committer | 2015-01-08 07:41:51 -0800 | |
| commit | 76725265fca15461931d9dc0e40ce1f73f903075 (patch) | |
| tree | 4a7bda7f1d3c1c7d92507263f91188a0f5c780bc /qt-ui | |
| parent | f7abde84afb9e8ae984746a91dc802759d8d82f6 (diff) | |
| download | subsurface-76725265fca15461931d9dc0e40ce1f73f903075.tar.gz | |
Dive d/l selection UI: Display the downloaded dives in a table
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/downloadfromdivecomputer.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp index 6a1650e3c..31d1ddaa0 100644 --- a/qt-ui/downloadfromdivecomputer.cpp +++ b/qt-ui/downloadfromdivecomputer.cpp @@ -514,9 +514,24 @@ int DiveImportedModel::rowCount(const QModelIndex& model) const return lastIndex - firstIndex; } -QVariant DiveImportedModel::data(const QModelIndex& model, int role) const +QVariant DiveImportedModel::data(const QModelIndex& index, int role) const { + if (!index.isValid()) + return QVariant(); + if (index.row() + firstIndex > lastIndex) + return QVariant(); + + struct dive* d = get_dive( index.row() + firstIndex); + if (role == Qt::DisplayRole) { + switch(index.column()){ + case 0 : return QVariant(d->when); + case 1 : return QVariant(d->duration); + case 2 : return QVariant(d->maxdepth); + case 3 : return QVariant(d->latitude); + case 4 : return QVariant(d->longitude); + } + } } void DiveImportedModel::setImportedDivesIndexes(int first, int last) |