Skip to content

Commit cb3364f

Browse files
rudivsnyalldawson
authored andcommittedJul 11, 2018
Add 'not selected' option for optional layer parameters in processing model view
Fixes #19329 (https://issues.qgis.org/issues/19329) Optional layer parameters in processing algorithms used in the graphical modeler add an empty string as the default parameter value, which can raise an exception during algorithm execution. This update replaces the default empty string with a default 'Not selected' option. (cherry-picked from 57fb4ef)
1 parent 4895cab commit cb3364f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎python/plugins/processing/gui/wrappers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,10 +864,10 @@ def createWidget(self):
864864
self.combo = QComboBox()
865865
layers = self.getAvailableLayers()
866866
self.combo.setEditable(True)
867+
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
868+
self.combo.addItem(self.NOT_SELECTED, self.NOT_SET_OPTION)
867869
for layer in layers:
868870
self.combo.addItem(self.dialog.resolveValueDescription(layer), layer)
869-
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
870-
self.combo.setEditText("")
871871

872872
widget = QWidget()
873873
layout = QHBoxLayout()

0 commit comments

Comments
 (0)
Please sign in to comment.