Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
rudivs authored and nyalldawson committed Jul 11, 2018
1 parent 4895cab commit cb3364f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/plugins/processing/gui/wrappers.py
Expand Up @@ -864,10 +864,10 @@ def createWidget(self):
self.combo = QComboBox()
layers = self.getAvailableLayers()
self.combo.setEditable(True)
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
self.combo.addItem(self.NOT_SELECTED, self.NOT_SET_OPTION)
for layer in layers:
self.combo.addItem(self.dialog.resolveValueDescription(layer), layer)
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
self.combo.setEditText("")

widget = QWidget()
layout = QHBoxLayout()
Expand Down

0 comments on commit cb3364f

Please sign in to comment.