Bug report #20401
QgsLayoutItemLegend::adjustBoxSize does not work for legend created from pyqgis
Status: | Open | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Map Composer/Printing | ||
Affected QGIS version: | 3.4.0 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 28221 |
Description
When QgsLayoutItemLegend is created directly from plugin, adjustBoxSize does not work. So when positioning the item, the size is always 0 and if can fall of the visible screen.
Maybe worth to add dpi parameter to adjustBoxSize and do not force to call paint() manually?
Possible workaround here:
https://github.com/lutraconsulting/qgis-crayfish-plugin/commit/e935bb1ebeb4c4131c2e96d361d7184073677ca2