mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
[processing] Fix optional layer parameters are filled by default
Refs #17471 Not a full fix for 17471 - that requires handling of optional numeric values too
This commit is contained in:
parent
0fcbeb7867
commit
8303b94685
@ -708,8 +708,6 @@ class MapLayerWidgetWrapper(WidgetWrapper):
|
|||||||
layout.addWidget(btn)
|
layout.addWidget(btn)
|
||||||
|
|
||||||
widget.setLayout(layout)
|
widget.setLayout(layout)
|
||||||
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
|
|
||||||
self.combo.setAllowEmptyLayer(True)
|
|
||||||
if ProcessingConfig.getSetting(ProcessingConfig.SHOW_CRS_DEF):
|
if ProcessingConfig.getSetting(ProcessingConfig.SHOW_CRS_DEF):
|
||||||
self.combo.setShowCrs(True)
|
self.combo.setShowCrs(True)
|
||||||
|
|
||||||
@ -720,6 +718,10 @@ class MapLayerWidgetWrapper(WidgetWrapper):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
|
||||||
|
self.combo.setAllowEmptyLayer(True)
|
||||||
|
self.combo.setLayer(None)
|
||||||
|
|
||||||
self.combo.currentIndexChanged.connect(lambda: self.widgetValueHasChanged.emit(self))
|
self.combo.currentIndexChanged.connect(lambda: self.widgetValueHasChanged.emit(self))
|
||||||
self.combo.currentTextChanged.connect(lambda: self.widgetValueHasChanged.emit(self))
|
self.combo.currentTextChanged.connect(lambda: self.widgetValueHasChanged.emit(self))
|
||||||
return widget
|
return widget
|
||||||
@ -907,8 +909,6 @@ class FeatureSourceWidgetWrapper(WidgetWrapper):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
|
|
||||||
self.combo.setAllowEmptyLayer(True)
|
|
||||||
if ProcessingConfig.getSetting(ProcessingConfig.SHOW_CRS_DEF):
|
if ProcessingConfig.getSetting(ProcessingConfig.SHOW_CRS_DEF):
|
||||||
self.combo.setShowCrs(True)
|
self.combo.setShowCrs(True)
|
||||||
|
|
||||||
@ -916,6 +916,10 @@ class FeatureSourceWidgetWrapper(WidgetWrapper):
|
|||||||
self.combo.setFilters(filters)
|
self.combo.setFilters(filters)
|
||||||
self.combo.setExcludedProviders(['grass'])
|
self.combo.setExcludedProviders(['grass'])
|
||||||
|
|
||||||
|
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
|
||||||
|
self.combo.setAllowEmptyLayer(True)
|
||||||
|
self.combo.setLayer(None)
|
||||||
|
|
||||||
self.combo.layerChanged.connect(self.layerChanged)
|
self.combo.layerChanged.connect(self.layerChanged)
|
||||||
return widget
|
return widget
|
||||||
|
|
||||||
@ -1179,8 +1183,6 @@ class VectorLayerWidgetWrapper(WidgetWrapper):
|
|||||||
|
|
||||||
if ProcessingConfig.getSetting(ProcessingConfig.SHOW_CRS_DEF):
|
if ProcessingConfig.getSetting(ProcessingConfig.SHOW_CRS_DEF):
|
||||||
self.combo.setShowCrs(True)
|
self.combo.setShowCrs(True)
|
||||||
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
|
|
||||||
self.combo.setAllowEmptyLayer(True)
|
|
||||||
|
|
||||||
filters = QgsMapLayerProxyModel.Filters()
|
filters = QgsMapLayerProxyModel.Filters()
|
||||||
if QgsProcessing.TypeVectorAnyGeometry in self.param.dataTypes() or len(self.param.dataTypes()) == 0:
|
if QgsProcessing.TypeVectorAnyGeometry in self.param.dataTypes() or len(self.param.dataTypes()) == 0:
|
||||||
@ -1201,6 +1203,10 @@ class VectorLayerWidgetWrapper(WidgetWrapper):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
|
||||||
|
self.combo.setAllowEmptyLayer(True)
|
||||||
|
self.combo.setLayer(None)
|
||||||
|
|
||||||
self.combo.currentIndexChanged.connect(lambda: self.widgetValueHasChanged.emit(self))
|
self.combo.currentIndexChanged.connect(lambda: self.widgetValueHasChanged.emit(self))
|
||||||
self.combo.currentTextChanged.connect(lambda: self.widgetValueHasChanged.emit(self))
|
self.combo.currentTextChanged.connect(lambda: self.widgetValueHasChanged.emit(self))
|
||||||
return widget
|
return widget
|
||||||
|
Loading…
x
Reference in New Issue
Block a user