Class: QgsProcessingModelerParameterWidget

class qgis.gui.QgsProcessingModelerParameterWidget(model: QgsProcessingModelAlgorithm, childId: str, parameter: QgsProcessingParameterDefinition, context: QgsProcessingContext, parent: QWidget = None)

Bases: PyQt5.QtWidgets.QWidget, qgis._core.QgsExpressionContextGenerator

Constructor for QgsProcessingModelerParameterWidget, for the specified parameter definition within the given model.

The ID of the child algorithm within the model must be specified via the childId argument. This value corresponds to the QgsProcessingModelChildAlgorithm.childId() string, which uniquely identifies which child algorithm the parameter is associated with inside the given model.

A Processing context must also be specified, which allows the widget to resolve parameter values which are context dependent. The context must last for the lifetime of the widget.

A widget for customising the value of Processing algorithm parameter inside a Processing model.

The widget provides choice of the linked source for values for the parameter inside the model. E.g. parameters can be a static value, an evaluated expression results, the output from another child algorithm, or an input parameter for the model itself.

Individual modeler parameter widgets are not usually created directly, instead they are constructed through the central registry, via calls to QgsGui.processingGuiRegistry()->createModelerParameterWidget().

New in version 3.4: Methods

actionEvent
changeEvent
childEvent
closeEvent
connectNotify
contextMenuEvent
create
createExpressionContext
createLabel Creates a label for use identifying the associated parameter.
customEvent
destroy
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
enterEvent
event
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPreviousChild
hideEvent
initPainter
inputMethodEvent
isSignalConnected
keyPressEvent
keyReleaseEvent
leaveEvent
metric
mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
moveEvent
nativeEvent
paintEvent
parameterDefinition Returns the parameter definition associated with this wrapper.
populateSources Populates the widget with available sources for the parameter’s value, e.g.
receivers
registerProcessingContextGenerator Registers a Processing context generator class that will be used to retrieve a Processing context for the widget when required.
resizeEvent
sender
senderSignalIndex
setExpressionHelpText Set the expected expression format text, which is shown in the expression builder dialog for the widget when in the “pre-calculated” expression mode.
setWidgetContext Sets the context in which the modeler parameter widget is shown, e.g., the parent model algorithm and other relevant information which allows the widget to fine-tune its behavior.
setWidgetValue Sets the current value for the parameter.
sharedPainter
showEvent
tabletEvent
timerEvent
updateMicroFocus
value Returns the current value of the parameter.
wheelEvent

Signals

Attributes

actionEvent()
changeEvent()
childEvent()
closeEvent()
connectNotify()
contextMenuEvent()
create()
createExpressionContext(self) → QgsExpressionContext
createLabel(self) → QLabel

Creates a label for use identifying the associated parameter.

The caller takes ownership of the returned value.

customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
event()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
initPainter()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent()
parameterDefinition(self) → QgsProcessingParameterDefinition

Returns the parameter definition associated with this wrapper.

populateSources(self, compatibleParameterTypes: Iterable[str], compatibleOutputTypes: Iterable[str], compatibleDataTypes: Iterable[int])

Populates the widget with available sources for the parameter’s value, e.g. adding the available child algorithm outputs and model input parameter choices.

In order to determine the available source, the compatibleParameterTypes and compatibleOutputTypes arguments are used. These lists correspond to the various available values for QgsProcessingParameterDefinition.type() (for compatibleParameterTypes) and the values for QgsProcessingOutputDefinition.type() (for compatibleOutputTypes).

The compatibleDataTypes list corresponds to the compatible data types from QgsProcessing.SourceType.

receivers()
registerProcessingContextGenerator(self, generator: QgsProcessingContextGenerator)

Registers a Processing context generator class that will be used to retrieve a Processing context for the widget when required.

resizeEvent()
sender()
senderSignalIndex()
setExpressionHelpText(self, text: str)

Set the expected expression format text, which is shown in the expression builder dialog for the widget when in the “pre-calculated” expression mode. This is purely a text format and no expression validation is made against it.

setWidgetContext(self, context: QgsProcessingParameterWidgetContext)

Sets the context in which the modeler parameter widget is shown, e.g., the parent model algorithm and other relevant information which allows the widget to fine-tune its behavior.

setWidgetValue(self, value: QgsProcessingModelChildParameterSource)

Sets the current value for the parameter.

See also

value()

sharedPainter()
showEvent()
tabletEvent()
timerEvent()
updateMicroFocus()
value(self) → QgsProcessingModelChildParameterSource

Returns the current value of the parameter.

See also

setWidgetValue()

wheelEvent()