mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
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:
parent
42f36d6315
commit
2cded299ac
1 changed files with 9 additions and 1 deletions
|
@ -32,7 +32,7 @@ void DivePictureModel::updateDivePictures(int divenr)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dive *d = get_dive(divenr);
|
struct dive *d = get_dive(divenr);
|
||||||
int numberOfPictures = dive_get_picture_count(d);
|
numberOfPictures = dive_get_picture_count(d);
|
||||||
if (!d || numberOfPictures == 0) {
|
if (!d || numberOfPictures == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,15 @@ int DivePictureModel::columnCount(const QModelIndex &parent) const
|
||||||
|
|
||||||
QVariant DivePictureModel::data(const QModelIndex &index, int role) 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
|
int DivePictureModel::rowCount(const QModelIndex &parent) const
|
||||||
|
|
Loading…
Reference in a new issue