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¶
Base classes¶
- 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
parameterdefinition.- Parameters:
parameter (Optional[QgsProcessingParameterDefinition])
type (Qgis.ProcessingMode = Qgis.ProcessingMode.Standard)
parent (Optional[QWidget] = None)
- currentLayer(self) QgsMapLayer | None[source]¶
Returns the current layer selected in the combobox, or
Noneif 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
- 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
- Return type:
str
- isEditable(self) bool[source]¶
Returns whether the combo box value can be freely edited.
See also
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
Added in version 3.14.
- Parameters:
editable (bool)
- setLayer(self, layer: QgsMapLayer | None)[source]¶
Sets the combo box to the specified
layer, iflayeris compatible with the widget’s parameter definition.- Parameters:
layer (Optional[QgsMapLayer])
- setValue(self, value: Any, context: QgsProcessingContext)[source]¶
Sets the
valueshown in the widget.See also
- Parameters:
value (Any)
context (QgsProcessingContext)
- setWidgetContext(self, context: QgsProcessingParameterWidgetContext)[source]¶
Sets the
contextin which the widget is shown.Added in version 3.14.
- Parameters:
context (QgsProcessingParameterWidgetContext)
- 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.