Symbology including hardcoded geometry generator buffers (e.g. buffer($geometry,80,80)), here for a point layer, is displayed in the legend item exactly as in the map item. This is undesireable since the symbol covers half the legend item.
If the geometry genereator buffer is based on an attribute (e.g. buffer($geometry, (CASE WHEN TYPE = 'A' THEN 50 WHEN TYPE = 'B' THEN 75 ELSE 100 END),80)) the symbol is displayed as it was in 3.16, as a point with a small rectangle surrounding it. While not ideal, this is preferrable over the behaviour described above.
Create a (temporary) geometry layer with a text-attribute called TYPE using a projected CRS
Digitize at least one feature, the attribute can be filled in as 'A' or 'B', any other charater/string or be left empty
In the layer properties go to the symbology tab
Add a layer to the symbology
Change the style of the new layer to geometry generator
Enter buffer($geometry,80,80) as the geometry to be displayed
Save the symbology, close the layer properties
Duplicate the layer
Go to the layer properties of the duplicated layer
In the symbology tab, change the expression for the geometry generator to buffer($geometry, (CASE WHEN TYPE = 'A' THEN 50 WHEN TYPE = 'B' THEN 75 ELSE 100 END),80)
Save the symbology and close the duplicated layer's properties
Add a layout to the project
Add a map item to the layout
In the map item zoom to the created feature layer so the features cover a significant portion of the canvas
Add a legend item to the layout
Add the original and the duplicated layer to the legend item. The original layer should cover a large portion of the legend item
What is the bug or the crash?
Layout manager - Legend item & geometry generated symbols
Symbology including hardcoded geometry generator buffers (e.g.
buffer($geometry,80,80)
), here for a point layer, is displayed in the legend item exactly as in the map item. This is undesireable since the symbol covers half the legend item.If the geometry genereator buffer is based on an attribute (e.g.
buffer($geometry, (CASE WHEN TYPE = 'A' THEN 50 WHEN TYPE = 'B' THEN 75 ELSE 100 END),80)
) the symbol is displayed as it was in 3.16, as a point with a small rectangle surrounding it. While not ideal, this is preferrable over the behaviour described above.The following exported map shows the issue.
20220810_QGIS-3-22_Bug-report_geometry-generator-in-legend.pdf
Steps to reproduce the issue
buffer($geometry,80,80)
as the geometry to be displayedbuffer($geometry, (CASE WHEN TYPE = 'A' THEN 50 WHEN TYPE = 'B' THEN 75 ELSE 100 END),80)
Versions
QGIS-Version 3.22.9-Białowieża QGIS-Codeversion a8e9e6fa Qt-Version 5.15.3 Python-Version 3.9.5 GDAL-Version 3.5.1 PROJ-Version 9.0.1 EPSG-Registraturdatenbankversion v10.064 (2022-05-19) GEOS-Version 3.10.3-CAPI-1.16.1 SQLite-Version 3.38.1 PDAL-Version 2.3.0 PostgreSQL-Client-Version 14.3 SpatiaLite-Version 5.0.1 QWT-Version 6.1.6 QScintilla2-Version 2.13.1 BS-Version Windows 10 Version 2009
Aktive Python-Erweiterungen GeoCoding 2.18 LAStools 1.4 latlontools 3.6.4 Mergin 2022.5 point_selection 0.5 profiletool 4.2.2 QuickOSM 2.0.1 grassprovider 2.12.99 processing 2.12.99 sagaprovider 2.12.99
Supported QGIS version
New profile
Additional context
No response