Skip to content
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

Use QApplication::activeWindow() instead of QApplication::topLevelWidgets() to retrieve current screen #42733

Merged
merged 1 commit into from Apr 9, 2021

Conversation

nyalldawson
Copy link
Collaborator

QApplication::topLevelWidgets() can be EXTREMELY costly to call,
as it builds a list dynamically containing potentially dozens/hundreds
of widgets.

Fixes slow interaction with the layer tree in large projects

(master only)

QApplication::topLevelWidgets() to retrieve current screen

QApplication::topLevelWidgets() can  be EXTREMELY costly to call,
as it builds a list dynamically containing potentially dozens/hundreds
of widgets.

Fixes slow interaction with the layer tree in large projects
@nyalldawson
Copy link
Collaborator Author

Ping @m-kuhn

@github-actions github-actions bot added this to the 3.20.0 milestone Apr 9, 2021
Copy link
Member

@m-kuhn m-kuhn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
Or better: "not worse than what we always have been doing"
Ideally we'd pass in a context for where this will be actually rendered, but that's a bigger undertaking of a general review of the hidpi code (not sure if qt did any advance here).

@nyalldawson
Copy link
Collaborator Author

Ideally we'd pass in a context for where this will be actually rendered, but that's a bigger undertaking of a general review of the hidpi code (not sure if qt did any advance here).

Honestly i'm not sure it's possible in qt models -- it's a big shortcoming where the view can't pass any context back to the data call , so we can't make a model which adapts to hidpi/non-hdpi view widgets on demand...

@m-kuhn
Copy link
Member

m-kuhn commented Apr 9, 2021

Exactly where I also landed ...
The best I could come up with is QgsXyzModel::setTargetDpi() and invalidate data when it changes.

@m-kuhn m-kuhn merged commit 6fa5a1e into qgis:master Apr 9, 2021
@nyalldawson nyalldawson deleted the no_top_level_widgets branch April 28, 2021 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants