LayoutItem's positionning should always be relative to page #37567
Labels
Bug
Either a bug report, or a bug fix. Let's hope for the latter!
Print Layouts
Related to QGIS Print Layouts, Atlas or Reporting frameworks
Describe the bug
In the UI, LayoutItem's positions are relative to a page (which you can choose using a spinbox). Internally however, the position is stored in absolute coordinates (relative to the whole layout).
A/ For the UI, as LayoutItem have no reference/index to their page, the page is determined dynamically, based on the item's position and the pages geometries. This leads to many non deterministic behaviors, (when page sizes change or are deleted, when saving/importing templates, etc.).
B/ Additionally, while coordinates are page-relative in the spinboxes, they seem so be absolute when using expressions (so that a "10" in the spinbox doesn't equal a "10" in expression unless on the first page).
Instead, I suggest we :
For backwards compatibility, if unset, the index would be 0 (first page) for all items, meaning it should be backwards compatible, as position relative to page 0 is the same as absolute position.
The page index would be changed automatically when moving items around in the canvas, but besides that, it would not be changed dynamically (so that theoretically, you can have an item linked to page 1 that appears on page 2).
(As a further step, we could even imaging allowing to position items relative to other map items instead of just pages.)
How to Reproduce
A/
300
in the height spinbox=> while typing 300, the first page's height goes through 3, so that the MapItem temporarily is on the second page, then gets attached to the second page
(this gets even worse in dynamic setups, for instance in an atlas with a data-defined page height)
B/
10
for the Y positionQGIS and OS versions
3.15 master, Windows
The text was updated successfully, but these errors were encountered: