Subgroup: Legend
Class: QgsLegendRenderer¶
-
class
qgis.core.
QgsLegendRenderer
(legendModel: QgsLayerTreeModel, settings: QgsLegendSettings)¶ Bases:
sip.wrapper
Construct legend renderer. The ownership of legend model does not change
QgsLegendRenderer(QgsLegendRenderer)
The QgsLegendRenderer class handles automatic layout and rendering of legend.The content is given by QgsLayerTreeModel instance. Various layout properties can be configured within QgsLegendRenderer.
All spacing and sizes are in millimeters.
New in version 2.6: Methods
drawLegend
Draw the legend with given painter. legendSize
Find out preferred legend size set by the client. minimumSize
Run the layout algorithm and determine the size required for legend nodeLegendStyle
setLegendSize
Set the preferred resulting legend size. setNodeLegendStyle
Signals
Attributes
-
drawLegend
(self, painter: QPainter)¶ Draw the legend with given painter. It will occupy the area reported in legendSize(). Painter should be scaled beforehand so that units correspond to millimeters.
-
legendSize
(self) → QSizeF¶ Find out preferred legend size set by the client. If null, the legend will be drawn with the minimum size
-
minimumSize
(self) → QSizeF¶ Run the layout algorithm and determine the size required for legend
-
nodeLegendStyle
(node: QgsLayerTreeNode, model: QgsLayerTreeModel) → QgsLegendStyle.Style¶
-
setLegendSize
(self, s: QSizeF)¶ Set the preferred resulting legend size.
-
setNodeLegendStyle
(node: QgsLayerTreeNode, style: QgsLegendStyle.Style)¶
-