What is the bug or the crash?
When adding a WMS layer from a group layer where no styling has been specified, QGIS should request the default style however does not appear to correctly handle the style at all. The layer itself has two styles (one from the group and one from the layer itself) both of which resolve to valid legend graphics.
ArcGIS Pro, for example, handles this by sending a empty &STYLES= parameter. This is conform OGC specification
All three of these requests return a valid legend graphic
http://dev-geoserver.gdnnet.lan/geoserver/nlog/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=gdw_ng_licence_salt_utm&style=
http://dev-geoserver.gdnnet.lan/geoserver/nlog/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=gdw_ng_licence_salt_utm&style=default-style-lic
http://dev-geoserver.gdnnet.lan/geoserver/nlog/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=gdw_ng_licence_salt_utm&style=licence_salt
I can confirm that if all other styles are removed, and only one style remains (default-style-) then QGIS handles it properly, so this indeed appears to be applications-side
Steps to reproduce the issue
- Add a WMS group layer child into QGIS without selecting a style, e.g. drag from Browser to Layers
- Layer will be added without style, and results in no legend being added
- Add the same layer via Layer>Vector>Add WMS/WMTS and select either style and it will be processed correctly, but the top level layer remains without a legend.
Versions
| QGIS version | 3.40.10-Bratislava |
| QGIS code revision | c98da2e682 |
| |
| Libraries |
| Qt version | 5.15.13 |
| Python version | 3.12.11 |
| GDAL version | 3.11.3 — Eganville |
| PROJ version | 9.6.2 |
| EPSG Registry database version | v12.013 (2025-05-26) |
| GEOS version | 3.13.1-CAPI-1.19.2 |
| SQLite version | 3.50.4 |
| PDAL version | 2.9.0 |
| PostgreSQL client version | unknown |
| SpatiaLite version | 5.1.0 |
| QWT version | 6.3.0 |
| QScintilla2 version | 2.14.1 |
| OS version | Windows 11 Version 2009 |
| |
| Active Python plugins |
| pdokservicesplugin | 5.2.0 |
| slyr_community | 6.0.0 |
| db_manager | 0.1.20 |
| MetaSearch | 0.3.6 |
| processing | 2.12.99 |
Supported QGIS version
New profile
Additional context
The data is being pulled from GeoServer v2.27.1
ArcGIS Pro version for comparison is 3.2.4
What is the bug or the crash?
When adding a WMS layer from a group layer where no styling has been specified, QGIS should request the default style however does not appear to correctly handle the style at all. The layer itself has two styles (one from the group and one from the layer itself) both of which resolve to valid legend graphics.
ArcGIS Pro, for example, handles this by sending a empty &STYLES= parameter. This is conform OGC specification
All three of these requests return a valid legend graphic
http://dev-geoserver.gdnnet.lan/geoserver/nlog/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=gdw_ng_licence_salt_utm&style=http://dev-geoserver.gdnnet.lan/geoserver/nlog/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=gdw_ng_licence_salt_utm&style=default-style-lichttp://dev-geoserver.gdnnet.lan/geoserver/nlog/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=gdw_ng_licence_salt_utm&style=licence_saltI can confirm that if all other styles are removed, and only one style remains (default-style-) then QGIS handles it properly, so this indeed appears to be applications-side
Steps to reproduce the issue
Versions
Supported QGIS version
New profile
Additional context
The data is being pulled from GeoServer v2.27.1
ArcGIS Pro version for comparison is 3.2.4