Bug report #18770

[Layout] Using an item variable to change its own properties dynamically does not work

Added by Harrissou Santanna over 6 years ago. Updated almost 6 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Map Composer/Printing
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

Description

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)

History

#1 Updated by Nyall Dawson over 6 years ago

Other actions trigger a refresh too - e.g. clicking refresh, changing to a new atlas feature, exporting the layout.

#2 Updated by Harrissou Santanna over 6 years ago

I could have bet that I tried the refresh button unsuccessfully but i'd have lost... So yes, my list was not complete.
Anyway, good to see that when output time comes, the expressions are applied.

#3 Updated by Jürgen Fischer almost 6 years ago

  • Status changed from Open to Feedback

Please test with QGIS 3.4 - QGIS 2.18 reached it's end of life.

#4 Updated by Harrissou Santanna almost 6 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.

Also available in: Atom PDF