Skip to content

Commit

Permalink
[processing][feature][needs-docs] allow to define model parameters as
Browse files Browse the repository at this point in the history
advanced
  • Loading branch information
alexbruy authored and nyalldawson committed Jun 24, 2019
1 parent 42562c6 commit 625cc01
Showing 1 changed file with 12 additions and 0 deletions.
Expand Up @@ -356,6 +356,13 @@ def setupUi(self):
self.requiredCheck.setChecked(not self.param.flags() & QgsProcessingParameterDefinition.FlagOptional)
self.verticalLayout.addWidget(self.requiredCheck)

self.advancedCheck = QCheckBox()
self.advancedCheck.setText(self.tr('Advanced'))
self.advancedCheck.setChecked(False)
if self.param is not None:
self.advancedCheck.setChecked(self.param.flags() & QgsProcessingParameterDefinition.FlagAdvanced)
self.verticalLayout.addWidget(self.advancedCheck)

# If child algorithm output is mandatory, disable checkbox
if isinstance(self.param, QgsProcessingDestinationParameter):
provider_name, child_name, output_name = self.param.name().split(':')
Expand Down Expand Up @@ -577,6 +584,11 @@ def accept(self):
else:
self.param.setFlags(self.param.flags() & ~QgsProcessingParameterDefinition.FlagOptional)

if self.advancedCheck.isChecked():
self.param.setFlags(self.param.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
else:
self.param.setFlags(self.param.flags() & ~QgsProcessingParameterDefinition.FlagAdvanced)

settings = QgsSettings()
settings.setValue("/Processing/modelParametersDefinitionDialogGeometry", self.saveGeometry())

Expand Down

0 comments on commit 625cc01

Please sign in to comment.