mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive pictures: Update pictures when thumbnails are ready
Connect the thumbnailer signal to the dive picture model slot. This needs some code-reshuffling in the dive picture model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
3967b1fd4d
commit
afe20ce029
3 changed files with 14 additions and 0 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue