Bug report #16673
Composer map element size not updated from expression
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Map Composer/Printing | ||
Affected QGIS version: | 2.18.9 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | invalid |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 24572 |
Description
When setting map element height and width as an expression, element size doesn't get updated instantly when expression value changes.
Neither do they update upon closing and reopening composer.
Nor do they update upon closing and reopening project or QGIS itself.
The only way to update those properties is to go to a menu, Deactivate expression and then Activate it back again.
Feels a lot like setting width and height properties manually:)
History
#1 Updated by Nyall Dawson over 7 years ago
- Status changed from Open to Feedback
The refresh button in the toolbar will force a recalculation, as will certain events like switching between features in an Atlas.
What expression are you using? When would you expect it to change?
#2 Updated by Nikolay Lebedev over 7 years ago
True, refresh button forces a recalc, missed that option.
However, it would be much better if recalculation is made upon changes of underlying data. I'm using expressions like this:
( x_max( geometry( get_feature( 'testframes', 'id', @layout_page ) ) ) - x_min( geometry( get_feature( 'testframes', 'id', @layout_page ) ) ) ) / 20
This one is for map width, so each map depends on a size of a particular feature, which in turn is determined upon composer page.
#3 Updated by Nyall Dawson over 7 years ago
I'd be concerned about the cost of refreshing the composition whenever a layer is edited. That's potentially a lot of extra calculations which would need to be performed, and with an expression using functions like get_feature it's not going to be possible to accurately calculate a list of dependent features in advance.
I think given that we're never going to be able to accurately capture every condition which could lead to an expression's value changing (e.g. - what if a custom python expression function is used?), it's ok to require users to manually refresh compositions in cases like this.
#4 Updated by Nikolay Lebedev over 7 years ago
Nyall, I think you're right with autorefresh, though maybe reopening a composer and/or project should trigger refresh. I thought there is some kind of pub/sub system underneath expression controlled properties. I've set another related issue #16684. Should I close this one for now?
#5 Updated by Giovanni Manghi about 7 years ago
- Resolution set to invalid
- Status changed from Feedback to Closed
Nikolay Lebedev wrote:
Nyall, I think you're right with autorefresh, though maybe reopening a composer and/or project should trigger refresh. I thought there is some kind of pub/sub system underneath expression controlled properties. I've set another related issue #16684. Should I close this one for now?
closing then in favor of #16684