Fix drag and drop for stacked diagrams (follow-up) #60600
+116
−54
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.
Follow-up #60278.
This PR adjusts issues and improves consistency with drag and drop behavior in other parts of QGIS. See #60596 for screencasts of the buggy behavior in the current master.
Namely, this PR:
Replaces the drop indicator, switching from a box to a horizontal line (which expands to the whole row). The rationale is that stacked diagrams don't handle (yet) a parent-child hierarchy (i.e., one cannot have nested stacked diagrams in the GUI), but act instead as a flat list. This is consistent with drag and drop for other flat lists in QGIS (e.g., classification symbol lists or graduated symbol lists).
Fixes an issue that moves the dropped item to the end of the list (i.e., an append operation), even if the desired position was, e.g., between other items.
Fixes an issue that makes it possible to obtain copies of the dragged object.
Enables moving multiple items and positioning them in the expected way (e.g., if a diagram A is below a diagram B before the drag, it should continue being below B once dropped).
Minor fixes: Allow dropping items below all other items (i.e., in the blank area), as well as in the whole row span (i.e., also for columns > 0).
Screencast of the result:
dragndrop_stackeddiagrams.mp4
Fix #60596