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

The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLegendRenderer. More...

#include <qgslegendsettings.h>

Public Member Functions

 QgsLegendSettings ()
 
void setTitle (const QString &t)
 
QString title () const
 
Qt::AlignmentFlag titleAlignment () const
 Returns the alignment of the legend title. More...
 
void setTitleAlignment (Qt::AlignmentFlag alignment)
 Sets the alignment of the legend title. More...
 
QgsComposerLegendStylerstyle (QgsComposerLegendStyle::Style s)
 Returns reference to modifiable style. More...
 
QgsComposerLegendStyle style (QgsComposerLegendStyle::Style s) const
 Returns style. More...
 
void setStyle (QgsComposerLegendStyle::Style s, const QgsComposerLegendStyle style)
 
double boxSpace () const
 
void setBoxSpace (double s)
 
void setWrapChar (const QString &t)
 
QString wrapChar () const
 
double columnSpace () const
 
void setColumnSpace (double s)
 
int columnCount () const
 
void setColumnCount (int c)
 
int splitLayer () const
 
void setSplitLayer (bool s)
 
int equalColumnWidth () const
 
void setEqualColumnWidth (bool s)
 
QColor fontColor () const
 
void setFontColor (const QColor &c)
 
QSizeF symbolSize () const
 
void setSymbolSize (QSizeF s)
 
QSizeF wmsLegendSize () const
 
void setWmsLegendSize (QSizeF s)
 
double lineSpacing () const
 
void setLineSpacing (double s)
 
double mmPerMapUnit () const
 
void setMmPerMapUnit (double mmPerMapUnit)
 
bool useAdvancedEffects () const
 
void setUseAdvancedEffects (bool use)
 
double mapScale () const
 
void setMapScale (double scale)
 
int dpi () const
 
void setDpi (int dpi)
 
QStringList splitStringForWrapping (QString stringToSplt) const
 Splits a string using the wrap char taking into account handling empty wrap char which means no wrapping. More...
 
void drawText (QPainter *p, double x, double y, const QString &text, const QFont &font) const
 Draws Text. More...
 
void drawText (QPainter *p, const QRectF &rect, const QString &text, const QFont &font, Qt::AlignmentFlag halignment=Qt::AlignLeft, Qt::AlignmentFlag valignment=Qt::AlignTop, int flags=Qt::TextWordWrap) const
 Like the above, but with a rectangle for multiline text. More...
 
QFont scaledFontPixelSize (const QFont &font) const
 Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE. More...
 
double pixelFontSize (double pointSize) const
 Calculates font to from point size to pixel size. More...
 
double textWidthMillimeters (const QFont &font, const QString &text) const
 Returns the font width in millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. More...
 
double fontHeightCharacterMM (const QFont &font, const QChar &c) const
 Returns the font height of a character in millimeters. More...
 
double fontAscentMillimeters (const QFont &font) const
 Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. More...
 
double fontDescentMillimeters (const QFont &font) const
 Returns the font descent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. More...
 

Detailed Description

The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLegendRenderer.

The content of the legend is given in QgsLegendModel class.

Note
added in 2.6

Constructor & Destructor Documentation

QgsLegendSettings::QgsLegendSettings ( )

Member Function Documentation

double QgsLegendSettings::boxSpace ( ) const
inline
int QgsLegendSettings::columnCount ( ) const
inline
double QgsLegendSettings::columnSpace ( ) const
inline
int QgsLegendSettings::dpi ( ) const
inline
void QgsLegendSettings::drawText ( QPainter *  p,
double  x,
double  y,
const QString &  text,
const QFont &  font 
) const

Draws Text.

Takes care about all the composer specific issues (calculation to pixel, scaling of font and painter to work around the Qt font bug)

void QgsLegendSettings::drawText ( QPainter *  p,
const QRectF &  rect,
const QString &  text,
const QFont &  font,
Qt::AlignmentFlag  halignment = Qt::AlignLeft,
Qt::AlignmentFlag  valignment = Qt::AlignTop,
int  flags = Qt::TextWordWrap 
) const

Like the above, but with a rectangle for multiline text.

Parameters
ppainter to use
rectrectangle to draw into
texttext to draw
fontfont to use
halignmentoptional horizontal alignment
valignmentoptional vertical alignment
flagsallows for passing Qt::TextFlags to control appearance of rendered text
int QgsLegendSettings::equalColumnWidth ( ) const
inline
double QgsLegendSettings::fontAscentMillimeters ( const QFont &  font) const

Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE.

QColor QgsLegendSettings::fontColor ( ) const
inline
double QgsLegendSettings::fontDescentMillimeters ( const QFont &  font) const

Returns the font descent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE.

double QgsLegendSettings::fontHeightCharacterMM ( const QFont &  font,
const QChar &  c 
) const

Returns the font height of a character in millimeters.

double QgsLegendSettings::lineSpacing ( ) const
inline
double QgsLegendSettings::mapScale ( ) const
inline
double QgsLegendSettings::mmPerMapUnit ( ) const
inline
double QgsLegendSettings::pixelFontSize ( double  pointSize) const

Calculates font to from point size to pixel size.

QgsComposerLegendStyle& QgsLegendSettings::rstyle ( QgsComposerLegendStyle::Style  s)
inline

Returns reference to modifiable style.

QFont QgsLegendSettings::scaledFontPixelSize ( const QFont &  font) const

Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE.

void QgsLegendSettings::setBoxSpace ( double  s)
inline
void QgsLegendSettings::setColumnCount ( int  c)
inline
void QgsLegendSettings::setColumnSpace ( double  s)
inline
void QgsLegendSettings::setDpi ( int  dpi)
inline
void QgsLegendSettings::setEqualColumnWidth ( bool  s)
inline
void QgsLegendSettings::setFontColor ( const QColor &  c)
inline
void QgsLegendSettings::setLineSpacing ( double  s)
inline
void QgsLegendSettings::setMapScale ( double  scale)
inline
void QgsLegendSettings::setMmPerMapUnit ( double  mmPerMapUnit)
inline
void QgsLegendSettings::setSplitLayer ( bool  s)
inline
void QgsLegendSettings::setStyle ( QgsComposerLegendStyle::Style  s,
const QgsComposerLegendStyle  style 
)
inline
void QgsLegendSettings::setSymbolSize ( QSizeF  s)
inline
void QgsLegendSettings::setTitle ( const QString &  t)
inline
void QgsLegendSettings::setTitleAlignment ( Qt::AlignmentFlag  alignment)
inline

Sets the alignment of the legend title.

Parameters
alignmentText alignment for drawing the legend title
See also
titleAlignment
void QgsLegendSettings::setUseAdvancedEffects ( bool  use)
inline
void QgsLegendSettings::setWmsLegendSize ( QSizeF  s)
inline
void QgsLegendSettings::setWrapChar ( const QString &  t)
inline
int QgsLegendSettings::splitLayer ( ) const
inline
QStringList QgsLegendSettings::splitStringForWrapping ( QString  stringToSplt) const

Splits a string using the wrap char taking into account handling empty wrap char which means no wrapping.

QgsComposerLegendStyle QgsLegendSettings::style ( QgsComposerLegendStyle::Style  s) const
inline

Returns style.

QSizeF QgsLegendSettings::symbolSize ( ) const
inline
double QgsLegendSettings::textWidthMillimeters ( const QFont &  font,
const QString &  text 
) const

Returns the font width in millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE.

QString QgsLegendSettings::title ( ) const
inline
Qt::AlignmentFlag QgsLegendSettings::titleAlignment ( ) const
inline

Returns the alignment of the legend title.

Returns
Qt::AlignmentFlag for the legend title
See also
setTitleAlignment
bool QgsLegendSettings::useAdvancedEffects ( ) const
inline
QSizeF QgsLegendSettings::wmsLegendSize ( ) const
inline
QString QgsLegendSettings::wrapChar ( ) const
inline

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