qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.49k stars 2.99k forks source link

Map composer. "Lock style for layers" setting ignored by Legend element in complex projects. #55074

Open erydit opened 11 months ago

erydit commented 11 months ago

What is the bug or the crash?

In some complex projects "Lock style for layers" setting of the Map Item ignores. I attached an example project: example.zip

Steps to reproduce the issue

  1. Extract example.zip and open the example folder.
  2. Open the project qproj.qgz
  3. Notice that the layer "FieldBorders" have the active style "Style_1".
  4. Open the "Map_1". This layout was configured to use Style_2, and saved with the "Lock style for layers" property checked. And the Map looks as expected and uses Style_2. But in the Legend the Item FieldBorders is decorated as the Style_1. 1
  5. OK, Return to the map view and select "Style_2" in the style properties of the FieldBorders layer. And open the Map_1 layout again. Now one of the Items looks as expected, and another use wrong style. 2
  6. Uncheck and check again "Lock style for layers" to reload all styles of the Map. Now the Second Legent item use Style_2 . 3
  7. Save the layout with the current settings. Select "Style_1" for the FieldBorders layer. Save and close the project.
  8. Open the project again. And open Map_1 layout. And again the Legend looks wrong and uses the style that is active in the mapview despite that we saved the layout with the Style_2 in the 6 and 7 steps. 1

The realy bad thing about that bug is that a cant use ">qgis_process run native:atlaslayouttopdf ..." to render several layouts because some of them would be decorated in the wrong styles.

Versions

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

Версия QGIS | 3.32.3-Lima | Кодовая ветка QGIS | Release 3.32 -- | -- | -- | -- Версия Qt при сборке | 5.15.10 | Текущая версия Qt | 5.15.11 Версия Python | 3.11.5 Версия GDAL/OGR при сборке | 3.7.1 | Текущая версия GDAL/OGR | 3.7.2 Версия PROJ | 9.3.0 Версия базы данных реестра EPSG | v10.094 (2023-08-08) Версия GEOS | 3.12.0-CAPI-1.18.0 Версия SQLite | 3.43.1 Версия PDAL | 2.5.6 Версия PostgreSQL | 16.0 Версия SpatiaLite | 5.1.0 Версия QWT | 6.2.0 Версия QScintilla2 | 2.14.1 Версия ОС | Manjaro Linux   |   |   |   Включенные модули Python valuetool | 3.0.17 SRTM-Downloader | 3.2.0 osminfo | 0.7.1 AnotherDXF2Shape | 1.3.1 quick_map_services | 0.19.33 processing_wbt | 1.3.5 QuickOSM | 2.2.3 maplibrary | 1.3 processing | 2.12.99 db_manager | 0.1.20 Версия QGIS 3.32.3-Lima Кодовая ветка QGIS [Release 3.32](https://github.com/qgis/QGIS/tree/release-3_32) Версия Qt при сборке 5.15.10 Текущая версия Qt 5.15.11 Версия Python 3.11.5 Версия GDAL/OGR при сборке 3.7.1 Текущая версия GDAL/OGR 3.7.2 Версия PROJ 9.3.0 Версия базы данных реестра EPSG v10.094 (2023-08-08) Версия GEOS 3.12.0-CAPI-1.18.0 Версия SQLite 3.43.1 Версия PDAL 2.5.6 Версия PostgreSQL 16.0 Версия SpatiaLite 5.1.0 Версия QWT 6.2.0 Версия QScintilla2 2.14.1 Версия ОС Manjaro Linux Включенные модули Python valuetool 3.0.17 SRTM-Downloader 3.2.0 osminfo 0.7.1 AnotherDXF2Shape 1.3.1 quick_map_services 0.19.33 processing_wbt 1.3.5 QuickOSM 2.2.3 maplibrary 1.3 processing 2.12.99 db_manager 0.1.20 ### Supported QGIS version - [X] I'm running a supported QGIS version according to [the roadmap](https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule). ### New profile - [X] I tried with a new [QGIS profile](https://docs.qgis.org/latest/en/docs/user_manual/introduction/qgis_configuration.html#working-with-user-profiles) ### Additional context _No response_
DelazJ commented 11 months ago

The realy bad thing about that bug is that a cant use ">qgis_process run native:atlaslayouttopdf ..." to render several layouts because some of them would be decorated in the wrong styles.

Use map theme in the meantime to lock your map rendering

erydit commented 11 months ago

@DelazJ Thank you for the advice! Map themes are indeed better way to organize styles and layers for the layouts. And they helped with the current issue.