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¶
Methods
Returns the current layer selected in the combobox, or |
|
Returns the current text of the selected item in the combobox. |
|
Returns whether the combo box value can be freely edited. |
|
Sets whether the combo box value can be freely edited. |
|
Sets the combo box to the specified layer, if layer is compatible with the widget's parameter definition. |
|
Sets the value shown in the widget. |
|
Sets the context in which the widget is shown. |
|
Returns the current value of the widget. |
Signals
Emitted whenever the value is changed in the widget. |
- class qgis.gui.QgsProcessingMapLayerComboBox[source]¶
Bases:
QWidget
- __init__(parameter: QgsProcessingParameterDefinition | None, type: QgsProcessingGui.WidgetType = QgsProcessingGui.Standard, parent: QWidget | None = None)
Constructor for QgsProcessingMapLayerComboBox, with the specified
parameter
definition.- Parameters:
parameter (Optional[QgsProcessingParameterDefinition])
type (QgsProcessingGui.WidgetType = QgsProcessingGui.Standard)
parent (Optional[QWidget] = None)
- 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
- 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
, iflayer
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
- Parameters:
value (Any)
context (QgsProcessingContext)
- setWidgetContext(self, context: QgsProcessingParameterWidgetContext)[source]¶
Sets the
context
in which the widget is shown.Added in version 3.14.
- Parameters:
context (QgsProcessingParameterWidgetContext)