Class: QgsLegendFilterButton¶
A tool button that allows enabling or disabling legend filter by contents of the map.
An additional pop down menu allows defining a boolean expression to refine the filtering.
Class Hierarchy¶
Base classes¶
- class qgis.gui.QgsLegendFilterButton[source]¶
Bases:
QToolButton- __init__(parent: QWidget | None = None)
Construct a new filter legend button
- Parameters:
parent (Optional[QWidget] = None) – The parent QWidget
- expressionText(self) str[source]¶
Returns the current text used as filter expression
- Return type:
str
- signal expressionTextChanged[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.
- registerExpressionContextGenerator(self, generator: QgsExpressionContextGenerator | None)[source]¶
Register an expression context generator class that will be used to retrieve an expression context for the button when required.
Added in version 3.32.
- Parameters:
generator (Optional[QgsExpressionContextGenerator])
- setExpressionText(self, expression: str | None)[source]¶
Sets the current text used as filter expression. This will update the menu
- Parameters:
expression (Optional[str])
- setVectorLayer(self, layer: QgsVectorLayer | None)[source]¶
Sets the associated vectorLayer May be
None- Parameters:
layer (Optional[QgsVectorLayer])
- vectorLayer(self) QgsVectorLayer | None[source]¶
Returns the current associated vectorLayer May be
None- Return type:
Optional[QgsVectorLayer]