Bug report #20406

QgsProcessingParameterEnum doesn't allow multiple selection in the modeler

Added by Etienne Trimaille over 1 year ago. Updated over 1 year ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Processing/Modeller
Affected QGIS version:3.5(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28226

Description

In a Processing algorithm, one of the parameter is a "QgsProcessingParameterEnum":

self.addParameter(
  QgsProcessingParameterEnum(
    self.OSM_OBJECTS,
    tr('OSM Objects'),
    options=['node', 'way', 'relation'],
    optional=False,
    defaultValue=[0, 1, 2],
    allowMultiple=True
))

This works well from the toolbox, I can indeed select many items and all options are checked by default.

But from the modeler, in the algorithm dialog, I can't select many items and the defaultValue is not correct. It's a simple QComboBox and by default it's only the first item is selected by default.

Expected behavior:
The user should be able to select many items and the default value (with many items selected) should work.

Associated revisions

Revision cccf9742
Added by Nyall Dawson over 1 year ago

[processing] Port enum widget wrapper to new API

Fixes:
- enum parameters set to "allow multiple" only allow a single
value selection when used in modeler
- optional enum parameters cannot be set to no value when
used outside of modeler

Fixes #20406

History

#1 Updated by Nyall Dawson over 1 year ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF