Add auto-wrap after setting for layout legends #61361
Add auto-wrap after setting for layout legends #61361nyalldawson merged 5 commits intoqgis:masterfrom
Conversation
Apply font scaling workaround to avoid unpredictable font metrics when zooming in/out of layout
|
This pull request has been tagged for the changelog.
You can edit the description. Format available for credits
Thank you! |
|
@nyalldawson A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged. Please update the description (not the comments) with helpful description and screenshot to help the work from documentors. Thank you! |
🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. 🪟 Windows buildsDownload Windows builds of this PR for testing. |
Allows legend text to be automatically wrapped after a set line length (in millimeters). This can prevent very wide auto-generated legends. Sponsored by North Road, thanks to SLYR
This isn't exposed, and needs more thought before it is (should we use RenderUnits or LayoutUnits?)
nirvn
left a comment
There was a problem hiding this comment.
Nice, I love of these things are so easy to add now that the legend is using our text renderer classes.
|
@nyalldawson |
|
@nyalldawson, Do you have an example of the use case of the data-defined "Assistant" entry, for this feature? Thanks |
|
@DelazJ this should be of use for atlases where you may want to tweak the legend appearance on different pages. Or for dynamic layouts which adjust legend sizes based on eg page orientation. |
|
Thanks @nyalldawson for the reply. I see how this can be done using expression. My point refers mainly to the Assistant widget that generates values sequentially, not really foreseeable. I can't see what data it may be compatible with, in real life situations. If you have such data/case, I think it may be of great help we share in the docs. Thanks. I saw the assistant widget on another option in the layout and got also surprised, |
|
@DelazJ assistant is just shown everywhere for these buttons. There's no use case I can see for it here, but it's just generic functionality from those buttons |
|
Thanks @nyalldawson That clarifies. |

Allows legend text to be automatically wrapped after a set line length (in millimeters).
This can prevent very wide auto-generated legends.
Sponsored by North Road, thanks to SLYR
Peek.2025-04-07.15-36.mp4