Add the data() method of the Picture Model.

This method should give the correct data to all views that the model is
connected to.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-06-02 19:18:07 -03:00 committed by Dirk Hohndel
parent 42f36d6315
commit 2cded299ac

View file

@ -32,7 +32,7 @@ void DivePictureModel::updateDivePictures(int divenr)
}
struct dive *d = get_dive(divenr);
int numberOfPictures = dive_get_picture_count(d);
numberOfPictures = dive_get_picture_count(d);
if (!d || numberOfPictures == 0) {
return;
}
@ -58,7 +58,15 @@ int DivePictureModel::columnCount(const QModelIndex &parent) const
QVariant DivePictureModel::data(const QModelIndex &index, int role) const
{
QVariant ret;
if (!index.isValid())
return ret;
QString key = stringPixmapCache.keys().at(index.row());
switch(role){
case Qt::DisplayRole : return key;
case Qt::DecorationRole : return stringPixmapCache[key];
}
}
int DivePictureModel::rowCount(const QModelIndex &parent) const