-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Custom tab distances for labels #59253
Conversation
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 buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
Nice!! format = QgsTextFormat()
format.setFont(getTestFont('bold'))
format.setSize(20)
format.setSizeUnit(QgsUnitTypes.RenderUnit.RenderPoints)
format.setTabPositions([QgsTextFormat.Tab(20), QgsTextFormat.Tab(24)]) # if 4mm are enough to fit a single letter
format.setTabStopDistanceUnit(Qgis.RenderUnit.Millimeters)
self.assertTrue(self.checkRender(format,
'text_tab_positions_fixed_size',
text=['with\tmany\ttabs', 'a\tb\tc'])) where the second line's |
It just runs over the tab stop, and the next tab character will advance to the next available tab stop past the current position. And if there's no remaining explicit tab stops, then all remaining tab characters are ignored |
Thanks, it makes sense! Maybe worth adding the test? |
Ok, done |
Hi, |
@DelazJ one cool use case is it allows the creation of table-like labels, because you can have multiline text with different "columns" of text lined up nicely. |
Allows setting a list of custom tab stop distances, instead of just a single distance
c33fbe5
to
7681f36
Compare
@nyalldawson |
Allows setting a list of custom tab stop distances, instead of just a single distance
Peek.2024-10-29.13-35.mp4
Sponsored by City of Freiburg im Breisgau