Arranging GUI elements in QGIS 3 processing model user interface
Yes, there is a way.
when you set a new Input element, the name you give to it is like an ID. So, add an input and call it '0', it´ll be the first to be displayed, after you hit OK, it´s possible to change the name to any word, and the pseudo ID continuos to be '0'. So the next input should be '1', hit OK, change the name and so on.
the order QGIS create is based on numerical and alphabetic ascending order.
In that way I could rearrange a model with 9 inputs with no problem. I only needed to re-Add all the inputs to be in the order I wanted.
Not as of QGIS 3.4 -- the order is always quasi-random.
Since QGIS 3.6 processing models can be exported as python algorithms (right click on the model):
This opens the resulting processing algorithm in the script editor.
The order of gui elements is defined in the method initAlgorithm()
:
from qgis.core import QgsProcessingParameterEnum
from qgis.core import QgsProcessingParameterFeatureSink
from qgis.core import QgsProcessingParameterVectorDestination
import processing
class BbbbProcessor(QgsProcessingAlgorithm):
def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterField('1formelfradrschlssel', ...
self.addParameter(QgsProcessingParameterField('2formelfradressschlsselversorger', ...
self.addParameter(QgsProcessingParameterField('3testaufkderschlossen', ...
self.addParameter(QgsProcessingParameterVectorLayer('adr', ...
self.addParameter(QgsProcessingParameterString('adrneinderschlflst', ...
...
The desired order of gui elements can be achieved by simply re-ordering the self.addParameter()
method calls.
Note that this is more a workaround, since it hae to be done any time parameters change. If on the other hand only the process itself is changed and not the parameters, one may simply copy and paste the initAlgorithm()
method.