Class: QgsProcessingModelerParameterWidget¶
- class qgis.gui.QgsProcessingModelerParameterWidget¶
Bases:
PyQt5.QtWidgets.QWidget
,QgsExpressionContextGenerator
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()
->:py:func:~createModelerParameterWidget.New in version 3.4.
QgsProcessingModelerParameterWidget(model:
QgsProcessingModelAlgorithm
, childId: str, parameter:QgsProcessingParameterDefinition
, context:QgsProcessingContext
, parent: QWidget = None) Constructor forQgsProcessingModelerParameterWidget
, for the specifiedparameter
definition within the givenmodel
.The ID of the child algorithm within the model must be specified via the
childId
argument. This value corresponds to theQgsProcessingModelChildAlgorithm.childId()
string, which uniquely identifies which child algorithm the parameter is associated with inside the givenmodel
.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.Methods
- rtype:
QgsExpressionContext
Creates a label for use identifying the associated parameter.
Returns
True
if the widget is set to the model output mode.Returns the model output name, if
isModelOutput()
isTrue
.Returns the parameter definition associated with this wrapper.
Populates the widget with available sources for the parameter's value, e.g.
Registers a Processing context
generator
class that will be used to retrieve a Processing context for the widget when required.Sets the parent
dialog
in which the widget is shown.Set the expected expression format
text
, which is shown in the expression builder dialog for the widget when in the "pre-calculated" expression mode.Sets the current source
type
for the parameter.Sets the widget to a model output, for destination parameters only.
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.Sets the current
value
for the parameter.Returns the current value of the parameter.
- actionEvent(self, QActionEvent)¶
- changeEvent(self, QEvent)¶
- childEvent(self, QChildEvent)¶
- closeEvent(self, QCloseEvent)¶
- connectNotify(self, QMetaMethod)¶
- contextMenuEvent(self, QContextMenuEvent)¶
- create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)¶
- createExpressionContext(self) QgsExpressionContext ¶
- Return type:
- createLabel(self) QLabel ¶
Creates a label for use identifying the associated parameter.
The caller takes ownership of the returned value.
- Return type:
QLabel
- customEvent(self, QEvent)¶
- destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)¶
- disconnectNotify(self, QMetaMethod)¶
- dragEnterEvent(self, QDragEnterEvent)¶
- dragLeaveEvent(self, QDragLeaveEvent)¶
- dragMoveEvent(self, QDragMoveEvent)¶
- dropEvent(self, QDropEvent)¶
- enterEvent(self, QEvent)¶
- event(self, QEvent) bool ¶
- focusInEvent(self, QFocusEvent)¶
- focusNextChild(self) bool ¶
- focusNextPrevChild(self, bool) bool ¶
- focusOutEvent(self, QFocusEvent)¶
- focusPreviousChild(self) bool ¶
- hideEvent(self, QHideEvent)¶
- initPainter(self, QPainter)¶
- inputMethodEvent(self, QInputMethodEvent)¶
- isModelOutput(self) bool ¶
Returns
True
if the widget is set to the model output mode.See also
See also
New in version 3.14.
- Return type:
bool
- isSignalConnected(self, QMetaMethod) bool ¶
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- leaveEvent(self, QEvent)¶
- metric(self, QPaintDevice.PaintDeviceMetric) int ¶
- modelOutputName(self) str ¶
Returns the model output name, if
isModelOutput()
isTrue
.See also
See also
New in version 3.14.
- Return type:
str
- mouseDoubleClickEvent(self, QMouseEvent)¶
- mouseMoveEvent(self, QMouseEvent)¶
- mousePressEvent(self, QMouseEvent)¶
- mouseReleaseEvent(self, QMouseEvent)¶
- moveEvent(self, QMoveEvent)¶
- nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int] ¶
- paintEvent(self, QPaintEvent)¶
- parameterDefinition(self) QgsProcessingParameterDefinition ¶
Returns the parameter definition associated with this wrapper.
- Return type:
- 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
andcompatibleOutputTypes
arguments are used. These lists correspond to the various available values forQgsProcessingParameterDefinition.type()
(forcompatibleParameterTypes
) and the values forQgsProcessingOutputDefinition.type()
(forcompatibleOutputTypes
).The
compatibleDataTypes
list corresponds to the compatible data types fromQgsProcessing
.SourceType.- Parameters:
compatibleParameterTypes (Iterable[str]) –
compatibleOutputTypes (Iterable[str]) –
compatibleDataTypes (Iterable[int]) –
- receivers(self, PYQT_SIGNAL) int ¶
- registerProcessingContextGenerator(self, generator: QgsProcessingContextGenerator)¶
Registers a Processing context
generator
class that will be used to retrieve a Processing context for the widget when required.- Parameters:
generator (QgsProcessingContextGenerator) –
- resizeEvent(self, QResizeEvent)¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setDialog(self, dialog: QDialog)¶
Sets the parent
dialog
in which the widget is shown.New in version 3.8.
- Parameters:
dialog (QDialog) –
- 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.- Parameters:
text (str) –
- setSourceType(self, type: QgsProcessingModelChildParameterSource.Source)¶
Sets the current source
type
for the parameter.New in version 3.24.
- Parameters:
- setToModelOutput(self, value: str)¶
Sets the widget to a model output, for destination parameters only.
See also
See also
New in version 3.14.
- Parameters:
value (str) –
- 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.- Parameters:
context (QgsProcessingParameterWidgetContext) –
- setWidgetValue(self, value: QgsProcessingModelChildParameterSource)¶
Sets the current
value
for the parameter.See also
setWidgetValue(self, values: Iterable[QgsProcessingModelChildParameterSource]) Sets the current
values
for the parameter.See also
New in version 3.14.
- Parameters:
value (QgsProcessingModelChildParameterSource) –
- showEvent(self, QShowEvent)¶
- tabletEvent(self, QTabletEvent)¶
- timerEvent(self, QTimerEvent)¶
- updateMicroFocus(self)¶
- value(self) Any ¶
Returns the current value of the parameter.
See also
- Return type:
Any
- wheelEvent(self, QWheelEvent)¶