Feature request #22121

Updated by Jürgen Fischer almost 5 years ago

This refers to a question on GIS Stack exchange (https://gis.stackexchange.com/questions/322831/sort-inputs-parameters-in-qgis-modeler).
I created a model in QGIS 3.6 with three inputs parameters (two vector layer and one vector field). When I run the model, the inputs are not sorted in a correct way: the vector field is requested before the vector layer.

I searched on previous feature requests and I found this #11702 https://issues.qgis.org/issues/11702 but it is closed now.

It would be nice to choose the order of the inputs parameters. For example, if the input parameters are sorted in alphabetical order, the user could name inputs "1_inputXX, 2_inputYY, etc.".

The proposed answer on GIS stackexchange is the following workaround :

Export Model as Python Algorithm to get a translated script of your model. Here you could order the parameters however you like in the
initAlgorithm() function. E.g.:
def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource('1conduites', '1_Conduites', types=[QgsProcessing.TypeVectorLine], defaultValue=None))
self.addParameter(QgsProcessingParameterVectorLayer('2regard', '2_Regard', types=[QgsProcessing.TypeVectorPoint], defaultValue=None))
self.addParameter(QgsProcessingParameterFeatureSource('3idregard', '3_ID_regard', types=[QgsProcessing.TypeVector], defaultValue=None))
self.addParameter(QgsProcessingParameterFeatureSink('Result', 'result', type=QgsProcessing.TypeVectorPolygon, createByDefault=True, defaultValue=None))