Bug report #18770
[Layout] Using an item variable to change its own properties dynamically does not work
|Affected QGIS version:||3.5(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 #:||26657|
Let's add a map item and try to change its position using data-defined properties.
If I write expression like
case when @layout_pageheight >210 then 10 else 40 end for the X position data-defined button, then anytime i change the page size crossing the 210, I can see the map item moving in the layout. Great!
Now if i write
case when @map_scale >5000 then 10 else 40 end for the same property and change the scale of the map item, it does not move... until something else triggers its displacement ie:
- I use the select/move item button to move the item
- I manually change the X position spinbox value
- or I have another call (let's say the one with layout_pageheight) that triggers a movement
In all these case, it will move to the data-defined position.
I checked with other internal variable of the map item (map_rotation, eg) and other items (eg, label item with its rotation data-defined button using item_id variable) and anytime I use an interval variable to set a property of the item, no change occurs dynamically.
This makes the layout item's variables a bit useless (as you can not even call them from another item properties in 2.18).
Affects both 2.18 and 3.1 (master)
#4 Updated by Harrissou Santanna about 4 years ago
- Affected QGIS version changed from 2.18.18 to 3.5(master)
- Status changed from Feedback to Open
Confirmed on master 3.5. Using @map_scale does not visually trigger the map item placement in my example; you may need to eg refresh the dialog beforehand.