feat(thumbnail grid): arrow key navigation & selection history #1220
+219
−2
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.
Summary
Arrow key navigation
Arrow keys events in MainWindow are intercepted by an eventFilter and trigger callbacks in ThumbGridLayout. Shift key events are also intercepted but do not block the event from continuing down Qt's event pipeline. Arrow key navigation mimics the behaviour of windows file explorer as outlined in #226, including multi-selection.
closes #226
Selection history
The last 30 (number chosen arbitrarily) selections are stored in a deque. Hitting R pops the most recent selection from the deque, and pushes the current selection to a second deque for redo-ing. Hitting Shift+R pops from the redo deque. It's very satisfying to use (I may be biased)
This feature could later be included into a higher level history, see #1215 for the full discussion !
Selection state changes are saved in the deques via a decorator for methods that modify the selection.
Because that includes the methods used for arrow key navigation, I wasn't able to cleanly separate these two features into two PRs... Sorry 😅
Tasks Completed