Bug report #20007

Substitutions don't play well with wrapped labels

Added by Anita Graser over 5 years ago. Updated over 5 years ago.

Assignee:Nyall Dawson
Affected QGIS version:3.3(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27829


To use substitutions and wordwrap expressions together in a label the user needs to configure the substitutions to include the newline character at the right location within the string. This is cumbersome and error prone.

Associated revisions

Revision 234985b5
Added by Nyall Dawson over 5 years ago

[needs-docs][labeling] Fix substitutions don't play well with wrapped labels

Fixes an issue identified in the upcoming QGIS Map Design 2nd ed
(spoiler alert!) where it's impossible to utilise label text
substitutions if you also want to use word wrapping.

This isn't possible to directly fix, because we need to evaluate
the full label expression (including the word wrapping component)
in order to actually HAVE text to substitute into.

So, a new setting has been added to the label formatting tab
allowing users to directly set an auto-wrapping line ideal
line size. This is applied AFTER label text evaluation, substitutions,
and the 'wrap text on' character, so it can play correctly well with
all these other settings. This also has the nice side-effect
of making auto label text wrapping more accessible to new
users/those unfamiliar with the wordwrap expression function.

Fixes #20007, and cleans up a chapter of QMD 2ed ;)


#1 Updated by Nyall Dawson over 5 years ago

  • Status changed from Open to In Progress

#2 Updated by Nyall Dawson over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF