Bug report #20035
Expressions like `aggregate` or `layer_property` use QgsProject().instance() instead of the expression context's project
| Status: | Open | ||
|---|---|---|---|
| Priority: | Normal | ||
| Assignee: | - | ||
| Category: | Expressions | ||
| Affected QGIS version: | 3.3(master) | Regression?: | No |
| Operating System: | Windows 10 | Easy fix?: | No |
| Pull Request or Patch supplied: | No | Resolution: | |
| Crashes QGIS or corrupts data: | No | Copied to github as #: | 27857 |
Description
Hi !
I'm writing a python algorithm for the processing framework allowing to export PDFs. This requires instantiating a QgsProject and accessing it's layouts without actually loading the QgsProject in the UI.
In the layouts, it seems the aggregate, layer_property and similar methods refer to the loaded QgsProject instead of the QgsProject to which the layout belongs.
I think the bug is in QgsExpressionUtils.h:341, where QgsProject.instance() is used, instead of the expression context's project.
Cheers,
Olivier