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.62k stars 3.01k forks source link

Labels: Data defined override of "Show Label" always wants the auxiliary storage option #47993

Open eurojam opened 2 years ago

eurojam commented 2 years ago

What is the bug or the crash?

setting a datadefined override for the show label option always asks for the auxiliary storage. Also if a field in the data was defined before. Workaround is to set it to the auxiliary storage and afterwards set it to your own attribute.

grafik

Steps to reproduce the issue

  1. add cinteger column for show label option
  2. set datadefined override to that column
  3. choose show/hide label tool and click on one label to hide
  4. the auxiliary dialog appears

Versions

QGIS version | 3.24.1-Tisler | QGIS code revision | 5709b824 -- | -- | -- | -- Qt version | 5.15.2 Python version | 3.9.5 GDAL/OGR version | 3.4.1 PROJ version | 8.2.1 EPSG Registry database version | v10.041 (2021-12-03) GEOS version | 3.10.2-CAPI-1.16.0 SQLite version | 3.37.2 PDAL version | 2.3.0 PostgreSQL client version | unknown SpatiaLite version | 5.0.1 QWT version | 6.1.3 QScintilla2 version | 2.11.5 OS version | Windows 10 Version 2009   |   |   |   Active Python plugins QNEAT3 | 1.0.4 db_manager | 0.1.20 grassprovider | 2.12.99 MetaSearch | 0.3.6 processing | 2.12.99 sagaprovider | 2.12.99 QGIS version 3.24.1-Tisler QGIS code revision [5709b824](https://github.com/qgis/QGIS/commit/5709b824) Qt version 5.15.2 Python version 3.9.5 GDAL/OGR version 3.4.1 PROJ version 8.2.1 EPSG Registry database version v10.041 (2021-12-03) GEOS version 3.10.2-CAPI-1.16.0 SQLite version 3.37.2 PDAL version 2.3.0 PostgreSQL client version unknown SpatiaLite version 5.0.1 QWT version 6.1.3 QScintilla2 version 2.11.5 OS version Windows 10 Version 2009 Active Python plugins QNEAT3 1.0.4 db_manager 0.1.20 grassprovider 2.12.99 MetaSearch 0.3.6 processing 2.12.99 sagaprovider 2.12.99 ### Supported QGIS version - [ ] I'm running a supported QGIS version according to the roadmap. ### New profile - [ ] I tried with a new QGIS profile ### Additional context _No response_
effjot commented 1 year ago

This bug still appears for me (QGIS 3.28.7 and 3.32.2) when using Postgres layers and a linked table for labeling settings. Moving and rotating works without issues. The dialog asking for the key for auxiliary pops up, and after clicking ok, an empty (i.e. no fields, not even labeling_show) auxiliary storage is set up. QGIS writes the show/hide settings in the correct location, so this is just a confusing nuisance. Would be nice, if the dialog wouldn’t pop up, though. Thanks!

pblottiere commented 1 year ago

Hello @effjot,

I didn't succeed in reproducing your issue. What I have done:

  1. open a PostgreSQL layer (points geometry)
  2. configure the layer to display label
  3. use the show/hide map tool to hide some labels (the dialog window is displayed the first time to select the primary key)
  4. save the project and reopen
  5. show/hide some other labels => the dialog window is not popped

@effjot let me know if I missed something.

effjot commented 1 year ago

Thanks @pblottiere for looking into it. I have checked again with Qgis 3.28.11 and confirm that the dialog still pops up when not needed. Steps to reproduce:

  1. add PostgreSQL layer with points
  2. add PostgreSQL table (no geometry) with fields positionx, positiony, show, rotation
  3. join layer and table in the layer properties
  4. set DDO for position, show, rotation to use the fields from the joined table
  5. start editing the table
  6. select layer, use label tool to move and rotate labels → works as expected: no auxiliary storage dialog pops up, label positions and rotations are stored in the table
  7. use label tool to hide label → when clicking on a label the first time, the auxiliary storage dialog pops up unecessarily
  8. Click OK in the dialog → auxiliary storage is set up with the selected key, but contains no fields (not even labeling_show)
  9. hide a label with the tool → setting is stored in the table, as expected, auxiliary storage remains empty

If I use attribute fields in the layer itself instead of a joined table, the dialog seems to pop up only when editing of the layer is not turned on. The move and rotation tool turn on editing automatically; after that (or when manually starting to edit the layer), the hide/show tool works without popping up the dialog.

So it is not really a bug, but an annoyance. Labeling works as expected, we just have to remember to not worry about the dialog and just press ok. Doesn’t feel quite good, though. ;-)