Class: QgsDefaultVectorLayerLegend¶
- class qgis.core.QgsDefaultVectorLayerLegend¶
Bases:
QgsMapLayerLegend
Default legend implementation for vector layers
New in version 2.6:
Methods
- param nodeLayer:
- param elem:
Sets if a legend for the labeling should be shown
Sets per-symbol content of labels for "text on symbol" functionality.
Sets whether the "text on symbol" functionality is enabled.
Sets text format of symbol labels for "text on symbol" functionality.
Returns whether the legend for the labeling is shown
Returns per-symbol content of labels for "text on symbol" functionality.
Returns whether the "text on symbol" functionality is enabled.
Returns text format of symbol labels for "text on symbol" functionality.
- param doc:
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- createLayerTreeModelLegendNodes(self, nodeLayer: QgsLayerTreeLayer) List[QgsLayerTreeModelLegendNode] ¶
- Parameters:
nodeLayer (QgsLayerTreeLayer) –
- Return type:
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- readXml(self, elem: QDomElement, context: QgsReadWriteContext)¶
- Parameters:
elem (QDomElement) –
context (QgsReadWriteContext) –
- receivers(self, PYQT_SIGNAL) int ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setShowLabelLegend(self, enabled: bool)¶
Sets if a legend for the labeling should be shown
- Parameters:
enabled (bool) – true to show label legend entries
New in version 3.20.
- setTextOnSymbolContent(self, content: Dict[str, str])¶
Sets per-symbol content of labels for “text on symbol” functionality. In the passed dictionary the keys are rule keys of legend items, the values are labels to be shown.
New in version 3.2.
- Parameters:
content (Dict[str) –
- setTextOnSymbolEnabled(self, enabled: bool)¶
Sets whether the “text on symbol” functionality is enabled. When enabled, legend symbols may have extra text rendered on top. The content of labels and their style is controlled by
textOnSymbolContent()
andtextOnSymbolTextFormat()
.New in version 3.2.
- Parameters:
enabled (bool) –
- setTextOnSymbolTextFormat(self, format: QgsTextFormat)¶
Sets text format of symbol labels for “text on symbol” functionality.
New in version 3.2.
- Parameters:
format (QgsTextFormat) –
- showLabelLegend(self) bool ¶
Returns whether the legend for the labeling is shown
New in version 3.20.
- Return type:
bool
- textOnSymbolContent(self) Dict[str, str] ¶
Returns per-symbol content of labels for “text on symbol” functionality. In the passed dictionary the keys are rule keys of legend items, the values are labels to be shown.
New in version 3.2.
- Return type:
Dict[str, str]
- textOnSymbolEnabled(self) bool ¶
Returns whether the “text on symbol” functionality is enabled. When enabled, legend symbols may have extra text rendered on top. The content of labels and their style is controlled by
textOnSymbolContent()
andtextOnSymbolTextFormat()
.New in version 3.2.
- Return type:
bool
- textOnSymbolTextFormat(self) QgsTextFormat ¶
Returns text format of symbol labels for “text on symbol” functionality.
New in version 3.2.
- Return type:
- timerEvent(self, QTimerEvent)¶
- writeXml(self, doc: QDomDocument, context: QgsReadWriteContext) QDomElement ¶
- Parameters:
doc (QDomDocument) –
context (QgsReadWriteContext) –
- Return type:
QDomElement