Add multi-selection to ImageGallery#3054
Merged
Conversation
Copilot created this pull request from a session on behalf of
fabiencastan
March 22, 2026 09:57
View session
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3054 +/- ##
========================================
Coverage 83.47% 83.47%
========================================
Files 81 81
Lines 10300 10301 +1
========================================
+ Hits 8598 8599 +1
Misses 1702 1702 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add getObjectAt() to SortFilterDelegateModel for accessing filtered items - Add selectedIndices, toggleIndex(), selectRange(), clearMultiSelection() to sortedModel - Update ImageDelegate with isInMultiSelection property, removeSelectedRequest signal, visual highlight - Update onPressed in ImageGallery.qml for Ctrl/Shift-click multi-selection - Add sendRemoveSelectedRequest() and removeSelectedImagesRequest signal - Add Escape key to clear multi-selection in grid/list views - Add removeImages() slot in graph.py for single undo operation - Connect onRemoveSelectedImagesRequest in WorkspaceView.qml Co-authored-by: fabiencastan <153585+fabiencastan@users.noreply.github.com> Agent-Logs-Url: https://github.com/alicevision/Meshroom/sessions/afa03f78-9c73-481b-a448-8686e7ac4ed1
…nsistently Co-authored-by: fabiencastan <153585+fabiencastan@users.noreply.github.com> Agent-Logs-Url: https://github.com/alicevision/Meshroom/sessions/afa03f78-9c73-481b-a448-8686e7ac4ed1
26071a6 to
a6940c8
Compare
`removeSelectedRequest` was only used when the number of selected images exceeded 1, but it is useless to go through a different pipe when there is a single image or several, as the selection always remains available. `removeSelectedRequest` is thus called everytime and is enabled as soon as the selection is not empty.
…ection Before sending the removal request for the selection of images, check whether all the images are included in it. If so, we can use `removeAllImages` straight away, which will be more efficient computationally.
The `onRemoveSelectedImagesRequest` fully replaces the `onRemoveImageRequest` slot.
This allows to process the removal of a selection of images as a single operation rather than looping over each image and performing the same checks everytime, thus improving the performance.
8a4f01a to
07af4b8
Compare
`sortedModel` may be destroyed before we reach the call to `clearMultiSelection`. If this is the case, then that call raises some errors, as `sortedModel` has become `undefined`. Capturing it in a variable prior to performing any operation that may destroy it allows to still be able to access the object itself.
If enabled, the index in the gallery will not be reset to -1 by default, as it may cause a major move across the gallery. The option is enabled when a selection of images is removed, as it makes sense to remain close to where the last selected image was.
4b2f2df to
576c34d
Compare
cbentejac
approved these changes
Apr 27, 2026
99fdf3a to
444512c
Compare
nicolas-lambert-tc
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds multi-selection to the ImageGallery. The last clicked item continues to define
selectedViewIdfor the viewer. Multiple images can be selected and removed together as a single undoable operation via right-click context menu or Delete key.Description
Previously the ImageGallery only supported single-item selection. This adds standard multi-selection UX (Ctrl+Click to toggle, Shift+Click for range) and exposes a "Remove Selected Images" action for the selection.
Features list
selectedViewId(viewer follows it)Implementation remarks
Selection state is tracked in two new
sortedModelproperties:selectedIndex(existing) — the primary/last-clicked item, drives the viewerselectedIndices: [](new) — the full multi-selection set used for removal and highlightinggetObjectAt(filteredIndex)was added toSortFilterDelegateModelto let the gallery collect Python viewpoint attribute objects for all selected indices at removal time.Multi-image removal is handled by a new
removeImages(images)slot ingraph.pythat wraps individualremoveImage()calls inside a singlegroupedGraphModification, so the entire batch undoes as one step. Nested macros in Qt's undo stack correctly aggregate into the outer macro.The
onCurrentItemChangedguard in grid/list views prevents keyboard navigation from incorrectly resettingselectedIndicesby checkingsortedModel.selectedIndex !== root.currentIndexbefore clearing selection state.