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.67k stars 3.02k forks source link

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

Closed ptitjano closed 5 days ago

ptitjano commented 2 weeks ago

Description

This fixes an issue mentioned by @nyalldawson in https://github.com/qgis/QGIS-Enhancement-Proposals/issues/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.

github-actions[bot] commented 2 weeks ago

🪟 Windows builds

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

🪟 Windows Qt6 builds

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

nyalldawson commented 2 weeks ago

Good approach, I like where this is going! :+1:

ptitjano commented 1 week ago

@nyalldawson This should be ready now.

nyalldawson commented 1 week ago

Much cleaner, this is great! :100:

JanCaha commented 1 week ago

Looks good :+1: This approach will be useful for MeshLayer as well.