QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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>

Classes

class  Atom
 Atom is indivisible set (indivisible into more columns).
class  Nucleon
 Nucleon is either group title, layer title or layer child item.

Public Member Functions

 QgsLegendRenderer (QgsLayerTreeModel *legendModel, const QgsLegendSettings &settings)
 Construct legend renderer.
void drawLegend (QPainter *painter)
 Draw the legend with given painter.
QSizeF legendSize () const
 Find out preferred legend size set by the client.
QSizeF minimumSize ()
 Run the layout algorithm and determine the size required for legend.
void setLegendSize (QSizeF s)
 Set the preferred resulting legend size.

Static Public Member Functions

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

Detailed Description

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.

Note
added in 2.6

Definition at line 42 of file qgslegendrenderer.h.

Constructor & Destructor Documentation

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

Construct legend renderer.

The ownership of legend model does not change

Definition at line 32 of file qgslegendrenderer.cpp.

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.

Definition at line 43 of file qgslegendrenderer.cpp.

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

Definition at line 55 of file qgslegendrenderer.h.

QSizeF QgsLegendRenderer::minimumSize ( )

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

Definition at line 38 of file qgslegendrenderer.cpp.

QgsComposerLegendStyle::Style QgsLegendRenderer::nodeLegendStyle ( QgsLayerTreeNode node,
QgsLayerTreeModel model 
)
static

Definition at line 578 of file qgslegendrenderer.cpp.

void QgsLegendRenderer::setLegendSize ( QSizeF  s)
inline

Set the preferred resulting legend size.

Definition at line 52 of file qgslegendrenderer.h.

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

Definition at line 607 of file qgslegendrenderer.cpp.


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