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>
This commit is contained in:
Tomaz Canabrava 2015-01-08 10:25:38 -02:00 committed by Dirk Hohndel
parent f7abde84af
commit 76725265fc

View file

@ -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)