diff options
Diffstat (limited to 'qt-models/divepicturemodel.cpp')
-rw-r--r-- | qt-models/divepicturemodel.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/qt-models/divepicturemodel.cpp b/qt-models/divepicturemodel.cpp index 53e631e17..c5453c3a9 100644 --- a/qt-models/divepicturemodel.cpp +++ b/qt-models/divepicturemodel.cpp @@ -21,6 +21,8 @@ DivePictureModel::DivePictureModel() : rowDDStart(0), zoomLevel(0.0), defaultSize(defaultIconMetrics().sz_pic) { + connect(Thumbnailer::instance(), &Thumbnailer::thumbnailChanged, + this, &DivePictureModel::updateThumbnail, Qt::QueuedConnection); } void DivePictureModel::updateDivePicturesWhenDone(QList<QFuture<void>> futures) @@ -160,3 +162,13 @@ int DivePictureModel::rowCount(const QModelIndex &parent) const Q_UNUSED(parent); return pictures.count(); } + +void DivePictureModel::updateThumbnail(QString filename, QImage thumbnail) +{ + for (int i = 0; i < pictures.size(); ++i) { + if (pictures[i].filename != filename) + continue; + pictures[i].image = thumbnail; + emit dataChanged(createIndex(i, 0), createIndex(i, 1)); + } +} |