-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Recalculate layout when legend item size changes #38882
Conversation
15dc90b
to
e005d8d
Compare
Could you test with a project involving 1000s of layers and confirm there's no regressions in project handling speed here? I've previously seen that legend update code like this can cause temporary qgis hangs on large projects (that's an ongoing issue, but I don't want it to get any worse then it currently is!) |
What is the requirement exactly? Can I duplicate a vector layer 1000 times and add an AMS layer and test with that? |
That'd be a good test. Also throw a vector layer with rule based renderer or categorised renderer and 10000 categories in there. |
I'm confident this doesn't introduce any noticeable performance impact. It triggers a (deferred) repaint like any user interface interaction does (clicking somewhere, hitting a random key on the keyboard, scrolling, ...) and only does this under a specific condition. I'll try to create meaningful results. It fear it won't be easy. Talking about... Debugging the legend code I've seen code paths triggered repeatedly without any good reason, so if you say you've observed bad performance ... I'm not surprised. |
Confirmed with 10000 categories legend, 34 seconds to add the layer with and without the patch. |
Followup issue #38890 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, proceed at will!
This triggers an
update()
of the legend viewport when the size of the legend item changes.The solution is only partially satisfying. This should be done automatically by the model / view themselves. And it seems to work correctly for WMS. I couldn't find out why.
This patch works without any side effects. Happy to dump it in favor of an alternative approach.
Fixes #38881