Skip to content

Commit

Permalink
[processing] use active layer in the widget wrapper only for
Browse files Browse the repository at this point in the history
non-optional parameters otherwise use default value
  • Loading branch information
alexbruy authored and nyalldawson committed Dec 10, 2019
1 parent 89394a0 commit f37a759
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/plugins/processing/gui/wrappers.py
Expand Up @@ -936,7 +936,10 @@ def createWidget(self):
self.context = dataobjects.createContext()

try:
self.combo.setLayer(iface.activeLayer())
if self.parameterDefinition().flags() & QgsProcessingParameterDefinition.FlagOptional:
self.combo.setLayer(self.parameterDefinition().defaultValue())
else:
self.combo.setLayer(iface.activeLayer())
except:
pass

Expand Down

0 comments on commit f37a759

Please sign in to comment.