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 regression in legend column assignments #50597

Merged
merged 5 commits into from
Oct 21, 2022

Conversation

nyalldawson
Copy link
Collaborator

Since #39052 there's been a regression in the column assignment of some layout legends, where equal item heights will result in legend placements like:

Item 1    Item 2   Item 4
          Item 3

This PR repairs the logic, an adds an optimisation step after legend column assignment. This optimisation step is allowed to pack the earlier columns of a legend by shifting items back a column IF doing so results in a more compact legend, where EARLIER columns are more likely to take larger heights vs later columns.

It's limited to run at most twice, in order to avoid doing too much work.

Fixes #42672

@github-actions github-actions bot added this to the 3.28.0 milestone Oct 19, 2022
@nyalldawson
Copy link
Collaborator Author

Not suitable for backporting

when initially assigning columns to legend items

Refs qgis#42672, but in itself causes regressions in the test suite.

Basically, the existing logic has quite a number of errors and
the column assignment resulting from it was unpredictable. It was
mostly luck that the test suite passes, while other legend setups
(such as that from qgis#42672) would give inferior column assignments.
This optimisation step is allowed to pack the earlier columns of
a legend by shifting items back a column IF doing so results
in a more compact legend, where EARLIER columns are more likely
to take larger heights vs later columns.

It's limited to run at most twice, in order to avoid doing too
much work.

Fixes qgis#42672
src/core/qgslegendrenderer.cpp Show resolved Hide resolved
@nyalldawson nyalldawson merged commit 2095589 into qgis:master Oct 21, 2022
@nyalldawson nyalldawson deleted the fix_42672 branch October 21, 2022 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Legend: regression in column assignment when changing symbol spacing
2 participants