diff --git a/meshroom/ui/qml/ImageGallery/ImageDelegate.qml b/meshroom/ui/qml/ImageGallery/ImageDelegate.qml index baf75847..62f93680 100644 --- a/meshroom/ui/qml/ImageGallery/ImageDelegate.qml +++ b/meshroom/ui/qml/ImageGallery/ImageDelegate.qml @@ -31,17 +31,13 @@ Item { property var metadata: metadataStr ? JSON.parse(viewpoint.get("metadata").value) : {} } - onSourceChanged: { - thumbnail.source = ThumbnailCache.thumbnail(root.source) + // update thumbnail location + // can be called from the GridView when a new thumbnail has been written on disk + function updateThumbnail() { + thumbnail.source = ThumbnailCache.thumbnail(root.source); } - - Connections { - target: ThumbnailCache - function onThumbnailCreated(imgSource) { - if (imgSource == root.source) { - thumbnail.source = ThumbnailCache.thumbnail(root.source) - } - } + onSourceChanged: { + updateThumbnail(); } MouseArea { diff --git a/meshroom/ui/qml/ImageGallery/ImageGallery.qml b/meshroom/ui/qml/ImageGallery/ImageGallery.qml index c89afcce..63402980 100644 --- a/meshroom/ui/qml/ImageGallery/ImageGallery.qml +++ b/meshroom/ui/qml/ImageGallery/ImageGallery.qml @@ -201,6 +201,19 @@ Panel { } } + // Update grid item when corresponding thumbnail is computed + Connections { + target: ThumbnailCache + function onThumbnailCreated(imgSource) { + for (let i = 0; i < grid.count; i++) { + let item = grid.itemAtIndex(i); // item is an ImageDelegate + if (item && item.source == imgSource) { + item.updateThumbnail(); + } + } + } + } + model: SortFilterDelegateModel { id: sortedModel model: m.viewpoints