-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow printing of layout if filtered legend contains a layer that has a symbology classified using a virtual attribute #57230
Comments
This problem is still present in QGIS 3.34.6-1 |
I investigated the error a bit. Making the attribute Selezionato a "real" attribute (and not a virtual one), the printing process is fast even if the legend is filtered. |
@stafoo thanks for reporting. It would be useful if you provided a sample project and layet(s) with which the issue occurs. |
Sample project attached. Steps to reproduce:
|
Update on the bug.
|
I've spent quite some time trying to find a solution but I couldn't. The issue comes from the hit test task QgsMapHitTestTask which is run in a separate thread by the task manager and gets locked on a semaphore here: https://github.com/qgis/QGIS/blob/master/src/core/expression/qgsexpressionutils.cpp#L179 this happens because the The 30 seconds come from the @nyalldawson do you have any recommendation about how to handle this? |
Hmm, very tricky The only safe approach I can think would be to have some QgsPreparedExpressionData" which we generate in the main thread when creating that task. And then a bunch of plumbing to get that object passed to the expression at evaluation time (maybe attaching it to the expression context?). And then if the prepared expression data is available, we use it instead of calling the map layer function direct. |
@elpaso I have tested again this bug with this build: #57649 (comment) As noted by @m-kuhn (#57649 (comment)) the expression is_selected still slows down the printing process. My 2 cents |
Bug confirmed with QGIS 3.34.9 |
What is the bug or the crash?
Filtered legends in layouts slow down printing process in QGIS 3.34.5 and 3.36.1.
It happens when one layer has a symbology classified using a virtual attribute (such as a symbol showing only elements that are selected via is_selected() expression, as described here: #57230 (comment))
This behavios was not observed in QGIS 3.28.10 with the same project.
In the video example below, activating the filter option in legend significantly slows down the print process:
Registra_2024_04_23_15_55_37_919_compresso.mp4
This becomes even more critical with multipage layouts and with projects containing several layers.
This problem does not seems to be related to atlas.
Steps to reproduce the issue
Versions
Versione di QGIS | 3.34.5-Prizren
Revisione codice QGIS | 4b30849
Versione Qt | 5.15.3
Versione Python | 3.9.18
Versione GDAL/OGR | 3.8.4
Versione PROJ | 9.3.1
Versione database del Registro EPSG | v10.098 (2023-11-24)
Versione GEOS | 3.12.1-CAPI-1.18.1
Versione SQLite | 3.41.1
Versione PDAL | 2.6.0
Versione client PostgreSQL | 16.2
Versione SpatiaLite | 5.1.0
Versione QWT | 6.1.6
Versione QScintilla2 | 2.13.4
Versione SO | Windows 10 Version 2009
Plugins Python attivi
AnotherDXF2Shape | 1.3.1
contour | 2.0.13
felt | 2.0.1
LAStools | 2.1.0
mmqgis | 2021.9.10
nominatim_locator_filter | 0.3.2
OnlineRoutingMapper | 0.9
profiletool | 4.2.6
qfieldsync | v4.9.1
quick_map_services | 0.19.34
rivergis | 3.0
slyr_community | 5.0.0
StreetView | 3.2
db_manager | 0.1.20
grassprovider | 2.12.99
MetaSearch | 0.3.6
processing | 2.12.99
Supported QGIS version
New profile
The text was updated successfully, but these errors were encountered: