QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | Static Public Member Functions | List of all members
QgsLegendRenderer Class Reference

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. More...
 
QSizeF minimumSize ()
 Run the layout algorithm and determine the size required for legend. More...
 
void setLegendSize (QSizeF s)
 Set the preferred resulting legend size. More...
 
QSizeF legendSize () const
 Find out preferred legend size set by the client. More...
 
void drawLegend (QPainter *painter)
 Draw the legend with given painter. More...
 

Static Public Member Functions

static void setNodeLegendStyle (QgsLayerTreeNode *node, QgsComposerLegendStyle::Style style)
 
static
QgsComposerLegendStyle::Style 
nodeLegendStyle (QgsLayerTreeNode *node, QgsLayerTreeModel *model)
 

Detailed Description

The QgsLegendRenderer class handles automatic layout and rendering of legend.

The content is given by QgsLegendModel instance. Various layout properties can be configured within QgsLegendRenderer.

All spacing and sizes are in millimeters.

Note
added in 2.6

Constructor & Destructor Documentation

QgsLegendRenderer::QgsLegendRenderer ( QgsLayerTreeModel legendModel,
const QgsLegendSettings settings 
)

Construct legend renderer.

The ownership of legend model does not change

Member Function Documentation

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.

QSizeF QgsLegendRenderer::legendSize ( ) const
inline

Find out preferred legend size set by the client.

If null, the legend will be drawn with the minimum size

QSizeF QgsLegendRenderer::minimumSize ( )

Run the layout algorithm and determine the size required for legend.

QgsComposerLegendStyle::Style QgsLegendRenderer::nodeLegendStyle ( QgsLayerTreeNode node,
QgsLayerTreeModel model 
)
static
void QgsLegendRenderer::setLegendSize ( QSizeF  s)
inline

Set the preferred resulting legend size.

void QgsLegendRenderer::setNodeLegendStyle ( QgsLayerTreeNode node,
QgsComposerLegendStyle::Style  style 
)
static

The documentation for this class was generated from the following files: