QGIS API Documentation  2.7.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 ()
 
double boxSpace () const
 
int columnCount () const
 
double columnSpace () const
 
int dpi () const
 
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...
 
int equalColumnWidth () const
 
double fontAscentMillimeters (const QFont &font) const
 Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. More...
 
QColor fontColor () const
 
double fontDescentMillimeters (const QFont &font) const
 Returns the font descent 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 lineSpacing () const
 
double mapScale () const
 
double mmPerMapUnit () const
 
double pixelFontSize (double pointSize) const
 Calculates font to from point size to pixel size. More...
 
QgsComposerLegendStylerstyle (QgsComposerLegendStyle::Style s)
 Returns reference to modifiable style. 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...
 
void setBoxSpace (double s)
 
void setColumnCount (int c)
 
void setColumnSpace (double s)
 
void setDpi (int dpi)
 
void setEqualColumnWidth (bool s)
 
void setFontColor (const QColor &c)
 
void setLineSpacing (double s)
 
void setMapScale (double scale)
 
void setMmPerMapUnit (double mmPerMapUnit)
 
void setSplitLayer (bool s)
 
void setStyle (QgsComposerLegendStyle::Style s, const QgsComposerLegendStyle style)
 
void setSymbolSize (QSizeF s)
 
void setTitle (const QString &t)
 
void setTitleAlignment (Qt::AlignmentFlag alignment)
 Sets the alignment of the legend title. More...
 
void setUseAdvancedEffects (bool use)
 
void setWmsLegendSize (QSizeF s)
 
void setWrapChar (const QString &t)
 
int splitLayer () const
 
QStringList splitStringForWrapping (QString stringToSplt) const
 Splits a string using the wrap char taking into account handling empty wrap char which means no wrapping. More...
 
QgsComposerLegendStyle style (QgsComposerLegendStyle::Style s) const
 Returns style. More...
 
QSizeF symbolSize () const
 
double textWidthMillimeters (const QFont &font, const QString &text) const
 Returns the font width in millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. More...
 
QString title () const
 
Qt::AlignmentFlag titleAlignment () const
 Returns the alignment of the legend title. More...
 
bool useAdvancedEffects () const
 
QSizeF wmsLegendSize () const
 
QString wrapChar () const
 

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

Definition at line 36 of file qgslegendsettings.h.

Constructor & Destructor Documentation

QgsLegendSettings::QgsLegendSettings ( )

Definition at line 20 of file qgslegendsettings.cpp.

Member Function Documentation

double QgsLegendSettings::boxSpace ( ) const
inline

Definition at line 61 of file qgslegendsettings.h.

int QgsLegendSettings::columnCount ( ) const
inline

Definition at line 70 of file qgslegendsettings.h.

double QgsLegendSettings::columnSpace ( ) const
inline

Definition at line 67 of file qgslegendsettings.h.

int QgsLegendSettings::dpi ( ) const
inline

Definition at line 100 of file qgslegendsettings.h.

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)

Definition at line 64 of file qgslegendsettings.cpp.

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

Definition at line 77 of file qgslegendsettings.cpp.

int QgsLegendSettings::equalColumnWidth ( ) const
inline

Definition at line 76 of file qgslegendsettings.h.

double QgsLegendSettings::fontAscentMillimeters ( const QFont &  font) const

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

Definition at line 120 of file qgslegendsettings.cpp.

QColor QgsLegendSettings::fontColor ( ) const
inline

Definition at line 79 of file qgslegendsettings.h.

double QgsLegendSettings::fontDescentMillimeters ( const QFont &  font) const

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

Definition at line 127 of file qgslegendsettings.cpp.

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

Returns the font height of a character in millimeters.

Definition at line 113 of file qgslegendsettings.cpp.

double QgsLegendSettings::lineSpacing ( ) const
inline

Definition at line 88 of file qgslegendsettings.h.

double QgsLegendSettings::mapScale ( ) const
inline

Definition at line 97 of file qgslegendsettings.h.

double QgsLegendSettings::mmPerMapUnit ( ) const
inline

Definition at line 91 of file qgslegendsettings.h.

double QgsLegendSettings::pixelFontSize ( double  pointSize) const

Calculates font to from point size to pixel size.

Definition at line 101 of file qgslegendsettings.cpp.

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

Returns reference to modifiable style.

Definition at line 56 of file qgslegendsettings.h.

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

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

Definition at line 93 of file qgslegendsettings.cpp.

void QgsLegendSettings::setBoxSpace ( double  s)
inline

Definition at line 62 of file qgslegendsettings.h.

void QgsLegendSettings::setColumnCount ( int  c)
inline

Definition at line 71 of file qgslegendsettings.h.

void QgsLegendSettings::setColumnSpace ( double  s)
inline

Definition at line 68 of file qgslegendsettings.h.

void QgsLegendSettings::setDpi ( int  dpi)
inline

Definition at line 101 of file qgslegendsettings.h.

void QgsLegendSettings::setEqualColumnWidth ( bool  s)
inline

Definition at line 77 of file qgslegendsettings.h.

void QgsLegendSettings::setFontColor ( const QColor &  c)
inline

Definition at line 80 of file qgslegendsettings.h.

void QgsLegendSettings::setLineSpacing ( double  s)
inline

Definition at line 89 of file qgslegendsettings.h.

void QgsLegendSettings::setMapScale ( double  scale)
inline

Definition at line 98 of file qgslegendsettings.h.

void QgsLegendSettings::setMmPerMapUnit ( double  mmPerMapUnit)
inline

Definition at line 92 of file qgslegendsettings.h.

void QgsLegendSettings::setSplitLayer ( bool  s)
inline

Definition at line 74 of file qgslegendsettings.h.

void QgsLegendSettings::setStyle ( QgsComposerLegendStyle::Style  s,
const QgsComposerLegendStyle  style 
)
inline

Definition at line 59 of file qgslegendsettings.h.

void QgsLegendSettings::setSymbolSize ( QSizeF  s)
inline

Definition at line 83 of file qgslegendsettings.h.

void QgsLegendSettings::setTitle ( const QString &  t)
inline

Definition at line 41 of file qgslegendsettings.h.

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

Definition at line 53 of file qgslegendsettings.h.

void QgsLegendSettings::setUseAdvancedEffects ( bool  use)
inline

Definition at line 95 of file qgslegendsettings.h.

void QgsLegendSettings::setWmsLegendSize ( QSizeF  s)
inline

Definition at line 86 of file qgslegendsettings.h.

void QgsLegendSettings::setWrapChar ( const QString &  t)
inline

Definition at line 64 of file qgslegendsettings.h.

int QgsLegendSettings::splitLayer ( ) const
inline

Definition at line 73 of file qgslegendsettings.h.

QStringList QgsLegendSettings::splitStringForWrapping ( QString  stringToSplt) const

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

Definition at line 50 of file qgslegendsettings.cpp.

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

Returns style.

Definition at line 58 of file qgslegendsettings.h.

QSizeF QgsLegendSettings::symbolSize ( ) const
inline

Definition at line 82 of file qgslegendsettings.h.

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

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

Definition at line 106 of file qgslegendsettings.cpp.

QString QgsLegendSettings::title ( ) const
inline

Definition at line 42 of file qgslegendsettings.h.

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

Returns the alignment of the legend title.

Returns
Qt::AlignmentFlag for the legend title
See also
setTitleAlignment

Definition at line 48 of file qgslegendsettings.h.

bool QgsLegendSettings::useAdvancedEffects ( ) const
inline

Definition at line 94 of file qgslegendsettings.h.

QSizeF QgsLegendSettings::wmsLegendSize ( ) const
inline

Definition at line 85 of file qgslegendsettings.h.

QString QgsLegendSettings::wrapChar ( ) const
inline

Definition at line 65 of file qgslegendsettings.h.


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