Class: QgsProcessingMapLayerComboBox

Processing map layer combo box.

Warning

Not part of stable API and may change in future QGIS releases.

Added in version 3.8.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsProcessingMapLayerComboBox

Base classes

QWidget

QObject

QPaintDevice

class qgis.gui.QgsProcessingMapLayerComboBox[source]

Bases: QWidget

__init__(parameter: QgsProcessingParameterDefinition | None, type: Qgis.ProcessingMode = Qgis.ProcessingMode.Standard, parent: QWidget | None = None)

Constructor for QgsProcessingMapLayerComboBox, with the specified parameter definition.

Parameters:
currentLayer(self) QgsMapLayer | None[source]

Returns the current layer selected in the combobox, or None if the selection cannot be represented as a map layer.

Warning

Prefer calling value() instead, as it correctly encapsulates all valid values which can be represented by the widget.

See also

currentText()

Return type:

Optional[QgsMapLayer]

currentText(self) str[source]

Returns the current text of the selected item in the combobox.

Warning

Prefer calling value() instead, as it correctly encapsulates all valid values which can be represented by the widget.

See also

currentLayer()

Return type:

str

isEditable(self) bool[source]

Returns whether the combo box value can be freely edited.

See also

setEditable()

Added in version 3.14.

Return type:

bool

setEditable(self, editable: bool)[source]

Sets whether the combo box value can be freely edited.

See also

isEditable()

Added in version 3.14.

Parameters:

editable (bool)

setLayer(self, layer: QgsMapLayer | None)[source]

Sets the combo box to the specified layer, if layer is compatible with the widget’s parameter definition.

Parameters:

layer (Optional[QgsMapLayer])

setValue(self, value: Any, context: QgsProcessingContext)[source]

Sets the value shown in the widget.

See also

value()

Parameters:
setWidgetContext(self, context: QgsProcessingParameterWidgetContext)[source]

Sets the context in which the widget is shown.

Added in version 3.14.

Parameters:

context (QgsProcessingParameterWidgetContext)

value(self) Any[source]

Returns the current value of the widget.

See also

setValue()

Return type:

Any

signal valueChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.