QGIS API Documentation
3.4.15-Madeira (e83d02e274)
|
The QgsLegendRenderer class handles automatic layout and rendering of legend. More...
#include <qgslegendrenderer.h>
Public Member Functions | |
QgsLegendRenderer (QgsLayerTreeModel *legendModel, const QgsLegendSettings &settings) | |
Construct legend renderer. The ownership of legend model does not change. More... | |
void | drawLegend (QPainter *painter) |
Draw the legend with given painter. More... | |
QSizeF | legendSize () const |
Find out preferred legend size set by the client. If null, the legend will be drawn with the minimum size. More... | |
QSizeF | minimumSize () |
Run the layout algorithm and determine the size required for legend. More... | |
void | setLegendSize (QSizeF s) |
Sets the preferred resulting legend size. More... | |
Static Public Member Functions | |
static QgsLegendStyle::Style | nodeLegendStyle (QgsLayerTreeNode *node, QgsLayerTreeModel *model) |
static void | setNodeLegendStyle (QgsLayerTreeNode *node, QgsLegendStyle::Style style) |
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.
Definition at line 44 of file qgslegendrenderer.h.
QgsLegendRenderer::QgsLegendRenderer | ( | QgsLayerTreeModel * | legendModel, |
const QgsLegendSettings & | settings | ||
) |
Construct legend renderer. The ownership of legend model does not change.
Definition at line 30 of file qgslegendrenderer.cpp.
void QgsLegendRenderer::drawLegend | ( | QPainter * | painter | ) |
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.
Definition at line 41 of file qgslegendrenderer.cpp.
|
inline |
Find out preferred legend size set by the client. If null, the legend will be drawn with the minimum size.
Definition at line 57 of file qgslegendrenderer.h.
QSizeF QgsLegendRenderer::minimumSize | ( | ) |
Run the layout algorithm and determine the size required for legend.
Definition at line 36 of file qgslegendrenderer.cpp.
|
static |
Definition at line 580 of file qgslegendrenderer.cpp.
|
inline |
Sets the preferred resulting legend size.
Definition at line 54 of file qgslegendrenderer.h.
|
static |
Definition at line 608 of file qgslegendrenderer.cpp.