QGIS API Documentation
2.6.0-Brighton
|
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. | |
void | setTitleAlignment (Qt::AlignmentFlag alignment) |
Sets the alignment of the legend title. | |
QgsComposerLegendStyle & | rstyle (QgsComposerLegendStyle::Style s) |
Returns reference to modifiable style. | |
QgsComposerLegendStyle | style (QgsComposerLegendStyle::Style s) const |
Returns style. | |
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. | |
void | drawText (QPainter *p, double x, double y, const QString &text, const QFont &font) const |
Draws Text. | |
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. | |
QFont | scaledFontPixelSize (const QFont &font) const |
Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE. | |
double | pixelFontSize (double pointSize) const |
Calculates font to from point size to pixel size. | |
double | textWidthMillimeters (const QFont &font, const QString &text) const |
Returns the font width in millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. | |
double | fontHeightCharacterMM (const QFont &font, const QChar &c) const |
Returns the font height of a character in millimeters. | |
double | fontAscentMillimeters (const QFont &font) const |
Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. | |
double | fontDescentMillimeters (const QFont &font) const |
Returns the font descent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. |
The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLegendRenderer.
The content of the legend is given in QgsLegendModel class.
QgsLegendSettings::QgsLegendSettings | ( | ) |
|
inline |
|
inline |
|
inline |
|
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.
p | painter to use |
rect | rectangle to draw into |
text | text to draw |
font | font to use |
halignment | optional horizontal alignment |
valignment | optional vertical alignment |
flags | allows for passing Qt::TextFlags to control appearance of rendered text |
|
inline |
double QgsLegendSettings::fontAscentMillimeters | ( | const QFont & | font | ) | const |
Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE.
|
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.
|
inline |
|
inline |
|
inline |
double QgsLegendSettings::pixelFontSize | ( | double | pointSize | ) | const |
Calculates font to from point size to pixel size.
|
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.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets the alignment of the legend title.
alignment | Text alignment for drawing the legend title |
|
inline |
|
inline |
|
inline |
|
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.
|
inline |
Returns style.
|
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.
|
inline |
|
inline |
Returns the alignment of the legend title.
|
inline |
|
inline |
|
inline |