Class: QgsProcessingModelComponent

Represents a component of a model algorithm.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: clone()

Class Hierarchy

Inheritance diagram of qgis.core.QgsProcessingModelComponent

Subclasses

QgsProcessingModelChildAlgorithm

Child algorithm representing a single component of a QgsProcessingModelAlgorithm.

QgsProcessingModelComment

Represents a comment in a model.

QgsProcessingModelGroupBox

Represents a group box in a model.

QgsProcessingModelOutput

Represents a final output created by the model.

QgsProcessingModelParameter

Represents an input parameter used by the model.

Abstract Methods

clone

Clones the component.

Methods

color

Returns the color of the model component within the model designer.

copyNonDefinitionProperties

Copies all non-specific definition properties from the other component definition.

description

Returns the friendly description text for the component.

linksCollapsed

Returns True if the link points for the specified edge should be shown collapsed or not.

position

Returns the position of the model component within the model designer.

restoreCommonProperties

Restores the component properties from a QVariantMap.

saveCommonProperties

Saves the component properties to a QVariantMap.

setColor

Sets the color of the model component within the model designer.

setDescription

Sets the friendly description text for the component.

setLinksCollapsed

Sets whether the link points for the specified edge for this component should be shown collapsed in the model designer.

setPosition

Sets the position of the model component within the model designer.

setSize

Sets the size of the model component within the model designer.

size

Returns the size of the model component within the model designer.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsProcessingModelComponent. See the FAQ for more details.

comment

Returns the comment attached to this component (may be None)

setComment

Sets the comment attached to this component.

class qgis.core.QgsProcessingModelComponent[source]

Bases: object

__init__(description: str | None = '')

Only subclasses can be created

Parameters:

description (Optional[str] = '')

__init__(other: QgsProcessingModelComponent)

Copies are protected to avoid slicing

Parameters:

other (QgsProcessingModelComponent)

abstract clone(self) QgsProcessingModelComponent | None[source]

Clones the component.

Ownership is transferred to the caller.

Return type:

Optional[QgsProcessingModelComponent]

color(self) QColor[source]

Returns the color of the model component within the model designer.

An invalid color indicates that the default color for the component should be used.

See also

setColor()

Added in version 3.14.

Return type:

QColor

virtual comment(self) QgsProcessingModelComment | None[source]

Returns the comment attached to this component (may be None)

See also

setComment()

Return type:

Optional[QgsProcessingModelComment]

copyNonDefinitionProperties(self, other: QgsProcessingModelComponent)[source]

Copies all non-specific definition properties from the other component definition.

This includes properties like the size and position of the component, but not properties like the specific algorithm or input details.

Added in version 3.14.

Parameters:

other (QgsProcessingModelComponent)

description(self) str[source]

Returns the friendly description text for the component.

See also

setDescription()

Return type:

str

linksCollapsed(self, edge: Qt.Edge) bool[source]

Returns True if the link points for the specified edge should be shown collapsed or not.

Parameters:

edge (Qt.Edge)

Return type:

bool

position(self) QPointF[source]

Returns the position of the model component within the model designer.

See also

setPosition()

Return type:

QPointF

restoreCommonProperties(self, map: Dict[str, Any])[source]

Restores the component properties from a QVariantMap.

Parameters:

map (Dict[str, Any])

saveCommonProperties(self, map: Dict[str, Any])[source]

Saves the component properties to a QVariantMap.

Parameters:

map (Dict[str, Any])

setColor(self, color: QColor | Qt.GlobalColor)[source]

Sets the color of the model component within the model designer. An invalid color indicates that the default color for the component should be used.

See also

color()

Added in version 3.14.

Parameters:

color (Union[QColor, Qt.GlobalColor])

virtual setComment(self, comment: QgsProcessingModelComment)[source]

Sets the comment attached to this component.

See also

comment()

Parameters:

comment (QgsProcessingModelComment)

setDescription(self, description: str | None)[source]

Sets the friendly description text for the component.

See also

description()

Parameters:

description (Optional[str])

setLinksCollapsed(self, edge: Qt.Edge, collapsed: bool)[source]

Sets whether the link points for the specified edge for this component should be shown collapsed in the model designer.

See also

linksCollapsed()

Parameters:
  • edge (Qt.Edge)

  • collapsed (bool)

setPosition(self, position: QPointF | QPoint)[source]

Sets the position of the model component within the model designer.

See also

position()

Parameters:

position (Union[QPointF, QPoint])

setSize(self, size: QSizeF)[source]

Sets the size of the model component within the model designer.

See also

size()

Added in version 3.14.

Parameters:

size (QSizeF)

size(self) QSizeF[source]

Returns the size of the model component within the model designer.

See also

setSize()

Added in version 3.14.

Return type:

QSizeF