Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix drag and drop for stacked diagrams (follow-up) #60600

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

gacarrillor
Copy link
Member

@gacarrillor gacarrillor commented Feb 13, 2025

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:

  1. 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).

  2. 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.

  3. Fixes an issue that makes it possible to obtain copies of the dragged object.

  4. 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).

  5. 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).

  6. Clear leftover current index in the view after the drag'n'drop. This is how other flat lists behave, e.g., Graduated and Classification symbology for vector layers.

Screencast of the result:

dragndrop_stackeddiagrams.mp4

Fix #60596

@github-actions github-actions bot added this to the 3.42.0 milestone Feb 13, 2025
@gacarrillor gacarrillor added GUI/UX Related to QGIS application GUI or User Experience Bug Either a bug report, or a bug fix. Let's hope for the latter! Diagrams backport release-3_40 labels Feb 13, 2025
Copy link

github-actions bot commented Feb 13, 2025

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 5faf094)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 5faf094)

@gacarrillor gacarrillor force-pushed the dragndrop_stackdiagrams_followup branch 2 times, most recently from f5d8202 to 1940074 Compare February 14, 2025 09:05
@gacarrillor

This comment was marked as outdated.

@gacarrillor gacarrillor force-pushed the dragndrop_stackdiagrams_followup branch from 1940074 to ec63a27 Compare February 20, 2025 17:24
@gacarrillor
Copy link
Member Author

(Rebased)

@gacarrillor gacarrillor force-pushed the dragndrop_stackdiagrams_followup branch from ec63a27 to 633c12a Compare March 7, 2025 13:39
@gacarrillor
Copy link
Member Author

gacarrillor commented Mar 7, 2025

Thanks for the review @nirvn, I've addressed the comments to keep the fixes while keeping copy&paste eventual addition still possible (which, by the way I'd be happy to add in another PR).

@gacarrillor gacarrillor force-pushed the dragndrop_stackdiagrams_followup branch from 633c12a to 623e924 Compare March 8, 2025 12:48
@gacarrillor
Copy link
Member Author

The last commit clears the current item from the view. As you can see in this screencast, the current item is a leftover, since it sticks to the dragged item's index, showing no valuable information to users.

dragndrop_stackeddiagrams_active_items.mp4

Additionally, this clearing brings some harmonization with other flat lists after a drag'n'drop, e.g., Graduated and Classification ones for vector layer symbology.

@gacarrillor gacarrillor force-pushed the dragndrop_stackdiagrams_followup branch from 623e924 to 306aef4 Compare March 10, 2025 09:24
@gacarrillor
Copy link
Member Author

(Rebased to build on top of working CI)

…s (items don't have children so far), because of that, we can drop at any index as well
…en dropped 'inside' an item; only enable drops on invalid items, which eases dropping handling
…ent because it sticks to last activated item's index (the one that was dragged, thus remaining as a leftover from the user perspective, who would be more interested in the dropped index being the current item)
@gacarrillor gacarrillor force-pushed the dragndrop_stackdiagrams_followup branch from 306aef4 to 5faf094 Compare March 17, 2025 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport queued_ltr_backports Queued Backports backport release-3_42 Bug Either a bug report, or a bug fix. Let's hope for the latter! Diagrams GUI/UX Related to QGIS application GUI or User Experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Still) Unable to reorder subdiagrams in stacked diagrams dialog
3 participants