Class: QgsLayerTreeViewIndicator

Indicator that can be used in a layer tree view to display icons next to items of the layer tree.

They add extra context to the item and interactivity (using clicked() signal).

Indicators can be added/removed to individual layer tree items using QgsLayerTreeView.addIndicator() and QgsLayerTreeView.removeIndicator() calls.

Added in version 3.2.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsLayerTreeViewIndicator

Base classes

QObject

class qgis.gui.QgsLayerTreeViewIndicator[source]

Bases: QObject

__init__(parent: QObject | None = None)

Constructs an indicator, optionally transferring ownership to a parent QObject

Parameters:

parent (Optional[QObject] = None)

signal changed[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.

signal clicked[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.

icon(self) QIcon[source]

Indicator icon that will be displayed in the layer tree view

Return type:

QIcon

setIcon(self, icon: QIcon)[source]

Sets indicator icon that will be displayed in the layer tree view

Parameters:

icon (QIcon)

setToolTip(self, tip: str | None)[source]

Sets tool tip text

Parameters:

tip (Optional[str])

toolTip(self) str[source]

Returns tool tip text that will be shown when user hovers mouse over the indicator

Return type:

str