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

[Backport release-3_40] [elevation Profile] Correctly add a raster layer to an existing elevation profile widget #59830

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

qgis-bot
Copy link
Collaborator

Backport #59809
Authored by: @ptitjano

If an elevation profile widget is already open, when a new raster
layer is added, it is not added to the elevation widget
treeview. Indeed, when a new raster is added,
`QgsRasterLayer::elevationProperties::hasElevation()` returns `False`
by default and the proxy model of the elevation filters out the layers
which do not have an elevation.

Later on, `QgsAppLayerHandling::postProcessAddedLayer` is called on
this raster and it sets the elevation to `True` if it looks like a
DEM (See
`QgsRasterLayerElevationProperties::layerLooksLikeDem()`). However,
the layer tree of the elevation widget has already been populated and
it is not updated.

This issue is fixed by emitting the the `dataChanged` signal every
time the elevation properties of a layer changes. Indeed, this forces
a full refresh of the model and displays the raster in that case.
@github-actions github-actions bot added this to the 3.40.2 milestone Dec 11, 2024
Copy link

github-actions bot commented Dec 11, 2024

🪟 Windows builds

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

🪟 Windows Qt6 builds

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

@jef-n jef-n changed the title [Backport release-3_40] [elevation Profile] Correcly add a raster layer to an existing elevation profile widget [Backport release-3_40] [elevation Profile] Correctly add a raster layer to an existing elevation profile widget Dec 11, 2024
@nyalldawson nyalldawson merged commit 317cb92 into release-3_40 Dec 11, 2024
35 checks passed
@nyalldawson nyalldawson deleted the backport-59809-to-release-3_40 branch December 11, 2024 18:03
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.

3 participants