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

RasterLayer: Properly handle GUI updates when multiple canvas are displayed #59444

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ptitjano
Copy link
Contributor

Description

This fixes an issue mentioned by @nyalldawson in qgis/QGIS-Enhancement-Proposals#273

This occurs when the Min/Max settings is set in the renderer and multiple canvas are displayed. Indeed, in that case QgsRasterLayer updates the GUI (the renderer widget and the legend) multiple times when the rendered values are updated because each canvas causes a renderer update.

This issue is fixed by removing the GUI update from the raster layer code. With this change, when the rendered values are updated, these statistics (min-max) are propagated to the canvas by the use of a QgsRenderedItemDetails: QgsRenderedCalculatedResults. Then, only the main canvas is notified of this change and updates the GUI accordingly.

@ptitjano ptitjano self-assigned this Nov 14, 2024
@ptitjano ptitjano added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Nov 14, 2024
@github-actions github-actions bot added this to the 3.42.0 milestone Nov 14, 2024
@ptitjano ptitjano added the Rasters Related to general raster layer handling (not specific data formats) label Nov 14, 2024
@ptitjano ptitjano force-pushed the canvas-min-max branch 2 times, most recently from 5a37991 to 26595b2 Compare November 14, 2024 11:50
Copy link

github-actions bot commented Nov 14, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 61f86be)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 61f86be)

`QgsRasterLayer` updates the GUI (the renderer widget and the legend)
when the rendered values are updated. This does not work when multiple
canvas are displayed because each canvas causes a renderer update.

This issue is fixed by removing the GUI update from the raster layer
code. With this change, when the rendered values are updated, these
statistics are propagated to the canvas by the use of a
`QgsRenderedItemDetails`: `QgsRenderedCalculatedResults`. Then, only
the main canvas is notified of this change and updates the GUI
accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant