mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-23 00:02:38 -05:00
[processing] Set the active layer to one of the generated outputs
Fixes #57003
This commit is contained in:
parent
a9fee347eb
commit
51378f9827
@ -40,6 +40,7 @@ from qgis.core import (
|
||||
QgsLayerTreeLayer,
|
||||
QgsLayerTreeGroup
|
||||
)
|
||||
from qgis.utils import iface
|
||||
|
||||
from processing.core.ProcessingConfig import ProcessingConfig
|
||||
from processing.gui.RenderingStyles import RenderingStyles
|
||||
@ -264,10 +265,15 @@ def handleAlgorithmResults(alg: QgsProcessingAlgorithm,
|
||||
added_layers,
|
||||
key=lambda x: x[1].customProperty(SORT_ORDER_CUSTOM_PROPERTY, 0)
|
||||
)
|
||||
have_set_active_layer = False
|
||||
for group, layer_node in sorted_layer_tree_layers:
|
||||
layer_node.removeCustomProperty(SORT_ORDER_CUSTOM_PROPERTY)
|
||||
group.insertChildNode(0, layer_node)
|
||||
|
||||
if not have_set_active_layer and iface is not None:
|
||||
iface.setActiveLayer(layer_node.layer())
|
||||
have_set_active_layer = True
|
||||
|
||||
# all layers have been added to the layer tree, so safe to call
|
||||
# postProcessors now
|
||||
for layer, details in layers_to_post_process:
|
||||
|
Loading…
x
Reference in New Issue
Block a user