summaryrefslogtreecommitdiffstats
path: root/qt-ui/divepicturewidget.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-06-02 19:18:07 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 00:04:15 -0700
commit2cded299ace9dd5d312956dd3c65509971ded9b6 (patch)
treed0e31179f0aaded8a9511565f6acd1261721223a /qt-ui/divepicturewidget.cpp
parent42f36d6315f9eda15f982ee1f7fce3ec7c6cedf2 (diff)
downloadsubsurface-2cded299ace9dd5d312956dd3c65509971ded9b6.tar.gz
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>
Diffstat (limited to 'qt-ui/divepicturewidget.cpp')
-rw-r--r--qt-ui/divepicturewidget.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/qt-ui/divepicturewidget.cpp b/qt-ui/divepicturewidget.cpp
index d0155bd0f..01e52d6e8 100644
--- a/qt-ui/divepicturewidget.cpp
+++ b/qt-ui/divepicturewidget.cpp
@@ -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