QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
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
 Returns the legend box space (in millimeters), which is the empty margin around the inside of the legend's rectangle. More...
 
int columnCount () const
 Returns the desired minimum number of columns to show in the legend. More...
 
double columnSpace () const
 Returns the margin space between adjacent columns (in millimeters). More...
 
Q_DECL_DEPRECATED int dpi () const
 
bool drawRasterStroke () const
 Returns whether a stroke will be drawn around raster symbol items. 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...
 
void drawText (QPainter *p, double x, double y, const QString &text, const QFont &font) const
 Draws Text. More...
 
bool equalColumnWidth () const
 Returns true if all columns should have equal widths. More...
 
QStringList evaluateItemText (const QString &text, const QgsExpressionContext &context) const
 Splits a string using the wrap char taking into account handling empty wrap char which means no wrapping. More...
 
double fontAscentMillimeters (const QFont &font) const
 Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. More...
 
Q_DECL_DEPRECATED QColor fontColor () const
 Returns the font color used for legend items. More...
 
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, QChar c) const
 Returns the font height of a character in millimeters. More...
 
Qgis::LegendJsonRenderFlags jsonRenderFlags () const
 Returns the JSON export flags. More...
 
Q_DECL_DEPRECATED QColor layerFontColor () const
 Returns layer font color, defaults to fontColor() More...
 
Q_DECL_DEPRECATED double lineSpacing () const
 Returns the line spacing to use between lines of legend text. More...
 
Q_DECL_DEPRECATED double mapScale () const
 Returns the legend map scale. More...
 
Q_DECL_DEPRECATED double mapUnitsPerPixel () const
 Returns the factor of map units per pixel for symbols with size given in map units calculated by dpi and mmPerMapUnit. More...
 
double maximumSymbolSize () const
 Returns the maximum symbol size (in mm). More...
 
double minimumSymbolSize () const
 Returns the minimum symbol size (in mm). More...
 
Q_DECL_DEPRECATED double mmPerMapUnit () const
 
double pixelFontSize (double pointSize) const
 Calculates font to from point size to pixel size. More...
 
QColor rasterStrokeColor () const
 Returns the stroke color for the stroke drawn around raster symbol items. More...
 
double rasterStrokeWidth () const
 Returns the stroke width (in millimeters) for the stroke drawn around raster symbol items. More...
 
QgsLegendStylerstyle (QgsLegendStyle::Style s)
 Returns modifiable reference to the style for a legend component. 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)
 Sets the legend box space (in millimeters), which is the empty margin around the inside of the legend's rectangle. More...
 
void setColumnCount (int c)
 Sets the desired minimum number of columns to show in the legend. More...
 
void setColumnSpace (double s)
 Sets the margin space between adjacent columns (in millimeters). More...
 
Q_DECL_DEPRECATED void setDpi (int dpi)
 
void setDrawRasterStroke (bool enabled)
 Sets whether a stroke will be drawn around raster symbol items. More...
 
void setEqualColumnWidth (bool s)
 Sets whether all columns should have equal widths. More...
 
Q_DECL_DEPRECATED void setFontColor (const QColor &c)
 Sets the font color used for legend items. More...
 
void setJsonRenderFlags (const Qgis::LegendJsonRenderFlags &jsonRenderFlags)
 Sets the the JSON export flags to jsonRenderFlags. More...
 
Q_DECL_DEPRECATED void setLayerFontColor (const QColor &fontColor)
 Sets layer font color to fontColor Overrides fontColor() More...
 
Q_DECL_DEPRECATED void setLineSpacing (double s)
 Sets the line spacing to use between lines of legend text. More...
 
Q_DECL_DEPRECATED void setMapScale (double scale)
 Sets the legend map scale. More...
 
Q_DECL_DEPRECATED void setMapUnitsPerPixel (double mapUnitsPerPixel)
 Sets the mmPerMapUnit calculated by mapUnitsPerPixel mostly taken from the map settings. More...
 
void setMaximumSymbolSize (double size)
 Set the maximum symbol size for symbol (in millimeters). More...
 
void setMinimumSymbolSize (double size)
 Set the minimum symbol size for symbol (in millimeters). More...
 
Q_DECL_DEPRECATED void setMmPerMapUnit (double mmPerMapUnit)
 
void setRasterStrokeColor (const QColor &color)
 Sets the stroke color for the stroke drawn around raster symbol items. More...
 
void setRasterStrokeWidth (double width)
 Sets the stroke width for the stroke drawn around raster symbol items. More...
 
void setSplitLayer (bool s)
 Sets whether layer components can be split over multiple columns. More...
 
void setStyle (QgsLegendStyle::Style s, const QgsLegendStyle &style)
 Sets the style for a legend component. More...
 
void setSymbolAlignment (Qt::AlignmentFlag alignment)
 Sets the alignment for placement of legend symbols. More...
 
void setSymbolSize (QSizeF s)
 Sets the default symbol size (in millimeters) used for legend items. More...
 
void setSynchronousLegendRequests (bool b)
 Sets whether to request legend graphics synchronously. More...
 
void setTitle (const QString &t)
 Sets the title for the legend, which will be rendered above all legend items. More...
 
void setTitleAlignment (Qt::AlignmentFlag alignment)
 Sets the alignment of the legend title. More...
 
Q_DECL_DEPRECATED void setUseAdvancedEffects (bool use)
 
void setWmsLegendSize (QSizeF s)
 Sets the desired size (in millimeters) of WMS legend graphics shown in the legend. More...
 
void setWrapChar (const QString &t)
 Sets a string to use as a wrapping character. More...
 
bool splitLayer () const
 Returns true if layer components can be split over multiple columns. More...
 
QStringList splitStringForWrapping (const QString &stringToSplt) const
 Splits a string using the wrap char taking into account handling empty wrap char which means no wrapping. More...
 
QgsLegendStyle style (QgsLegendStyle::Style s) const
 Returns the style for a legend component. More...
 
Qt::AlignmentFlag symbolAlignment () const
 Returns the alignment for placement of legend symbols. More...
 
QSizeF symbolSize () const
 Returns the default symbol size (in millimeters) used for legend items. More...
 
bool synchronousLegendRequests () const
 Returns whether to request legend graphics synchronously. 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...
 
QString title () const
 Returns the title for the legend, which will be rendered above all legend items. More...
 
Qt::AlignmentFlag titleAlignment () const
 Returns the alignment of the legend title. More...
 
Q_DECL_DEPRECATED bool useAdvancedEffects () const
 
QSizeF wmsLegendSize () const
 Returns the size (in millimeters) of WMS legend graphics shown in the legend. More...
 
QString wrapChar () const
 Returns the string used as a wrapping character. 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.

Definition at line 37 of file qgslegendsettings.h.

Constructor & Destructor Documentation

◆ QgsLegendSettings()

QgsLegendSettings::QgsLegendSettings ( )

Definition at line 23 of file qgslegendsettings.cpp.

Member Function Documentation

◆ boxSpace()

double QgsLegendSettings::boxSpace ( ) const
inline

Returns the legend box space (in millimeters), which is the empty margin around the inside of the legend's rectangle.

See also
setBoxSpace()

Definition at line 95 of file qgslegendsettings.h.

◆ columnCount()

int QgsLegendSettings::columnCount ( ) const
inline

Returns the desired minimum number of columns to show in the legend.

If legend components have forced column breaks then the actual number of columns in the rendered legend may be larger than this value.

See also
setColumnCount()

Definition at line 147 of file qgslegendsettings.h.

◆ columnSpace()

double QgsLegendSettings::columnSpace ( ) const
inline

Returns the margin space between adjacent columns (in millimeters).

See also
setColumnSpace()

Definition at line 130 of file qgslegendsettings.h.

◆ dpi()

int QgsLegendSettings::dpi ( ) const
Deprecated:
Take dpi from render contexts instead.

Definition at line 158 of file qgslegendsettings.cpp.

◆ drawRasterStroke()

bool QgsLegendSettings::drawRasterStroke ( ) const
inline

Returns whether a stroke will be drawn around raster symbol items.

See also
setDrawRasterStroke()
rasterStrokeColor()
rasterStrokeWidth()

Definition at line 300 of file qgslegendsettings.h.

◆ drawText() [1/2]

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 205 of file qgslegendsettings.cpp.

◆ drawText() [2/2]

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 193 of file qgslegendsettings.cpp.

◆ equalColumnWidth()

bool QgsLegendSettings::equalColumnWidth ( ) const
inline

Returns true if all columns should have equal widths.

If false is returned then columns will be individually resized to their minimum possible width.

See also
setEqualColumnWidth()

Definition at line 180 of file qgslegendsettings.h.

◆ evaluateItemText()

QStringList QgsLegendSettings::evaluateItemText ( const QString &  text,
const QgsExpressionContext context 
) const

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

Returns the actual text to render for a legend item, split into separate lines.

The expression context argument is used to correctly evaluated expressions contained within legend item text.

Since
QGIS 3.6

Definition at line 168 of file qgslegendsettings.cpp.

◆ fontAscentMillimeters()

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

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

Definition at line 247 of file qgslegendsettings.cpp.

◆ fontColor()

QColor QgsLegendSettings::fontColor ( ) const

Returns the font color used for legend items.

See also
setFontColor()
Deprecated:
Use QgsLegendStyle::textFormat() instead.

Definition at line 67 of file qgslegendsettings.cpp.

◆ fontDescentMillimeters()

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

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

Definition at line 254 of file qgslegendsettings.cpp.

◆ fontHeightCharacterMM()

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

Returns the font height of a character in millimeters.

Definition at line 240 of file qgslegendsettings.cpp.

◆ jsonRenderFlags()

Qgis::LegendJsonRenderFlags QgsLegendSettings::jsonRenderFlags ( ) const

Returns the JSON export flags.

Since
QGIS 3.36

Definition at line 261 of file qgslegendsettings.cpp.

◆ layerFontColor()

QColor QgsLegendSettings::layerFontColor ( ) const

Returns layer font color, defaults to fontColor()

See also
setLayerFontColor()
fontColor()
Deprecated:
Use QgsLegendStyle::textFormat() instead.

Definition at line 80 of file qgslegendsettings.cpp.

◆ lineSpacing()

Q_DECL_DEPRECATED double QgsLegendSettings::lineSpacing ( ) const
inline

Returns the line spacing to use between lines of legend text.

See also
setLineSpacing()
Deprecated:
use QgsLegendStyle::textFormat() from style() instead.

Definition at line 387 of file qgslegendsettings.h.

◆ mapScale()

double QgsLegendSettings::mapScale ( ) const

Returns the legend map scale.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

See also
setMapScale()
Deprecated:
take this property from the render context instead

Definition at line 138 of file qgslegendsettings.cpp.

◆ mapUnitsPerPixel()

double QgsLegendSettings::mapUnitsPerPixel ( ) const

Returns the factor of map units per pixel for symbols with size given in map units calculated by dpi and mmPerMapUnit.

See also
setMapUnitsPerPixel()
Deprecated:
take these properties on render contexts instead

Definition at line 148 of file qgslegendsettings.cpp.

◆ maximumSymbolSize()

double QgsLegendSettings::maximumSymbolSize ( ) const
inline

Returns the maximum symbol size (in mm).

0.0 means there is no maximum set.

See also
setMaximumSymbolSize()
Since
QGIS 3.16

Definition at line 244 of file qgslegendsettings.h.

◆ minimumSymbolSize()

double QgsLegendSettings::minimumSymbolSize ( ) const
inline

Returns the minimum symbol size (in mm).

A value 0.0 means there is no minimum set.

See also
setMinimumSymbolSize
Since
QGIS 3.16

Definition at line 262 of file qgslegendsettings.h.

◆ mmPerMapUnit()

double QgsLegendSettings::mmPerMapUnit ( ) const
Deprecated:
Use scale factor from render contexts instead.

Definition at line 118 of file qgslegendsettings.cpp.

◆ pixelFontSize()

double QgsLegendSettings::pixelFontSize ( double  pointSize) const

Calculates font to from point size to pixel size.

Definition at line 228 of file qgslegendsettings.cpp.

◆ rasterStrokeColor()

QColor QgsLegendSettings::rasterStrokeColor ( ) const
inline

Returns the stroke color for the stroke drawn around raster symbol items.

The stroke is only drawn if drawRasterStroke() is true.

See also
setRasterStrokeColor()
drawRasterStroke()
rasterStrokeWidth()

Definition at line 318 of file qgslegendsettings.h.

◆ rasterStrokeWidth()

double QgsLegendSettings::rasterStrokeWidth ( ) const
inline

Returns the stroke width (in millimeters) for the stroke drawn around raster symbol items.

The stroke is only drawn if drawRasterStroke() is true.

See also
setRasterStrokeWidth()
drawRasterStroke()
rasterStrokeColor()

Definition at line 337 of file qgslegendsettings.h.

◆ rstyle()

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

Returns modifiable reference to the style for a legend component.

Note
Not available in Python bindings.

Definition at line 73 of file qgslegendsettings.h.

◆ scaledFontPixelSize()

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 220 of file qgslegendsettings.cpp.

◆ setBoxSpace()

void QgsLegendSettings::setBoxSpace ( double  s)
inline

Sets the legend box space (in millimeters), which is the empty margin around the inside of the legend's rectangle.

See also
boxSpace()

Definition at line 103 of file qgslegendsettings.h.

◆ setColumnCount()

void QgsLegendSettings::setColumnCount ( int  c)
inline

Sets the desired minimum number of columns to show in the legend.

If legend components have forced column breaks then the actual number of columns in the rendered legend may be larger than this value.

See also
columnCount()

Definition at line 157 of file qgslegendsettings.h.

◆ setColumnSpace()

void QgsLegendSettings::setColumnSpace ( double  s)
inline

Sets the margin space between adjacent columns (in millimeters).

See also
columnSpace()

Definition at line 137 of file qgslegendsettings.h.

◆ setDpi()

void QgsLegendSettings::setDpi ( int  dpi)
Deprecated:
Set dpi on render contexts instead.

Definition at line 163 of file qgslegendsettings.cpp.

◆ setDrawRasterStroke()

void QgsLegendSettings::setDrawRasterStroke ( bool  enabled)
inline

Sets whether a stroke will be drawn around raster symbol items.

Parameters
enabledset to true to draw borders
See also
drawRasterStroke()
setRasterStrokeColor()
setRasterStrokeWidth()

Definition at line 309 of file qgslegendsettings.h.

◆ setEqualColumnWidth()

void QgsLegendSettings::setEqualColumnWidth ( bool  s)
inline

Sets whether all columns should have equal widths.

If false, then then columns will be individually resized to their minimum possible width.

See also
equalColumnWidth()

Definition at line 189 of file qgslegendsettings.h.

◆ setFontColor()

void QgsLegendSettings::setFontColor ( const QColor &  c)

Sets the font color used for legend items.

See also
fontColor()
Deprecated:
Use QgsLegendStyle::textFormat() instead.

Definition at line 72 of file qgslegendsettings.cpp.

◆ setJsonRenderFlags()

void QgsLegendSettings::setJsonRenderFlags ( const Qgis::LegendJsonRenderFlags jsonRenderFlags)

Sets the the JSON export flags to jsonRenderFlags.

Since
QGIS 3.36

Definition at line 266 of file qgslegendsettings.cpp.

◆ setLayerFontColor()

void QgsLegendSettings::setLayerFontColor ( const QColor &  fontColor)

Sets layer font color to fontColor Overrides fontColor()

See also
layerFontColor()
fontColor()
Deprecated:
Use QgsLegendStyle::textFormat() instead.

Definition at line 85 of file qgslegendsettings.cpp.

◆ setLineSpacing()

void QgsLegendSettings::setLineSpacing ( double  s)

Sets the line spacing to use between lines of legend text.

See also
lineSpacing()
Deprecated:
use QgsLegendStyle::setTextFormat() from style() instead.

Definition at line 91 of file qgslegendsettings.cpp.

◆ setMapScale()

void QgsLegendSettings::setMapScale ( double  scale)

Sets the legend map scale.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

See also
mapScale()
Deprecated:
set this property on the render context instead

Definition at line 143 of file qgslegendsettings.cpp.

◆ setMapUnitsPerPixel()

void QgsLegendSettings::setMapUnitsPerPixel ( double  mapUnitsPerPixel)

Sets the mmPerMapUnit calculated by mapUnitsPerPixel mostly taken from the map settings.

See also
mapUnitsPerPixel()
Deprecated:
set these properties on render contexts instead

Definition at line 153 of file qgslegendsettings.cpp.

◆ setMaximumSymbolSize()

void QgsLegendSettings::setMaximumSymbolSize ( double  size)
inline

Set the maximum symbol size for symbol (in millimeters).

A symbol size of 0.0 indicates no maximum is set.

See also
maximumSymbolSize()
Since
QGIS 3.16

Definition at line 254 of file qgslegendsettings.h.

◆ setMinimumSymbolSize()

void QgsLegendSettings::setMinimumSymbolSize ( double  size)
inline

Set the minimum symbol size for symbol (in millimeters).

A symbol size of 0.0 indicates no minimum is set.

See also
minimumSymbolSize()
Since
QGIS 3.16

Definition at line 272 of file qgslegendsettings.h.

◆ setMmPerMapUnit()

void QgsLegendSettings::setMmPerMapUnit ( double  mmPerMapUnit)
Deprecated:
Set scale factor on render contexts instead.

Definition at line 123 of file qgslegendsettings.cpp.

◆ setRasterStrokeColor()

void QgsLegendSettings::setRasterStrokeColor ( const QColor &  color)
inline

Sets the stroke color for the stroke drawn around raster symbol items.

The stroke is only drawn if drawRasterStroke() is true.

Parameters
colorstroke color
See also
rasterStrokeColor()
setDrawRasterStroke()
setRasterStrokeWidth()

Definition at line 328 of file qgslegendsettings.h.

◆ setRasterStrokeWidth()

void QgsLegendSettings::setRasterStrokeWidth ( double  width)
inline

Sets the stroke width for the stroke drawn around raster symbol items.

The stroke is only drawn if drawRasterStroke() is true.

Parameters
widthstroke width in millimeters
See also
rasterStrokeWidth()
setDrawRasterStroke()
setRasterStrokeColor()

Definition at line 347 of file qgslegendsettings.h.

◆ setSplitLayer()

void QgsLegendSettings::setSplitLayer ( bool  s)
inline

Sets whether layer components can be split over multiple columns.

See also
splitLayer()

Definition at line 171 of file qgslegendsettings.h.

◆ setStyle()

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

Sets the style for a legend component.

See also
style()

Definition at line 87 of file qgslegendsettings.h.

◆ setSymbolAlignment()

void QgsLegendSettings::setSymbolAlignment ( Qt::AlignmentFlag  alignment)
inline

Sets the alignment for placement of legend symbols.

Only Qt::AlignLeft or Qt::AlignRight are supported values.

See also
symbolAlignment()
Since
QGIS 3.10

Definition at line 282 of file qgslegendsettings.h.

◆ setSymbolSize()

void QgsLegendSettings::setSymbolSize ( QSizeF  s)
inline

Sets the default symbol size (in millimeters) used for legend items.

See also
symbolSize()

Definition at line 236 of file qgslegendsettings.h.

◆ setSynchronousLegendRequests()

void QgsLegendSettings::setSynchronousLegendRequests ( bool  b)
inline

Sets whether to request legend graphics synchronously.

See also
synchronousLegendRequests()
Since
QGIS 3.34

Definition at line 370 of file qgslegendsettings.h.

◆ setTitle()

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

Sets the title for the legend, which will be rendered above all legend items.

See also
title()

Definition at line 47 of file qgslegendsettings.h.

◆ setTitleAlignment()

void QgsLegendSettings::setTitleAlignment ( Qt::AlignmentFlag  alignment)
inline

Sets the alignment of the legend title.

See also
titleAlignment()

Definition at line 66 of file qgslegendsettings.h.

◆ setUseAdvancedEffects()

void QgsLegendSettings::setUseAdvancedEffects ( bool  use)
Deprecated:
Set flag on render contexts instead.

Definition at line 133 of file qgslegendsettings.cpp.

◆ setWmsLegendSize()

void QgsLegendSettings::setWmsLegendSize ( QSizeF  s)
inline

Sets the desired size (in millimeters) of WMS legend graphics shown in the legend.

See also
wmsLegendSize()

Definition at line 361 of file qgslegendsettings.h.

◆ setWrapChar()

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

Sets a string to use as a wrapping character.

Whenever this string is encountered inside legend component text it will be automatically replaced with a new line character.

See also
wrapChar()

Definition at line 113 of file qgslegendsettings.h.

◆ splitLayer()

bool QgsLegendSettings::splitLayer ( ) const
inline

Returns true if layer components can be split over multiple columns.

See also
setSplitLayer()

Definition at line 164 of file qgslegendsettings.h.

◆ splitStringForWrapping()

QStringList QgsLegendSettings::splitStringForWrapping ( const QString &  stringToSplt) const

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

Definition at line 174 of file qgslegendsettings.cpp.

◆ style()

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

Returns the style for a legend component.

See also
setStyle()

Definition at line 80 of file qgslegendsettings.h.

◆ symbolAlignment()

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

Returns the alignment for placement of legend symbols.

Only Qt::AlignLeft or Qt::AlignRight are supported values.

See also
setSymbolAlignment()
Since
QGIS 3.10

Definition at line 292 of file qgslegendsettings.h.

◆ symbolSize()

QSizeF QgsLegendSettings::symbolSize ( ) const
inline

Returns the default symbol size (in millimeters) used for legend items.

See also
setSymbolSize()

Definition at line 229 of file qgslegendsettings.h.

◆ synchronousLegendRequests()

bool QgsLegendSettings::synchronousLegendRequests ( ) const
inline

Returns whether to request legend graphics synchronously.

See also
setSynchronousLegendRequests()
Since
QGIS 3.34

Definition at line 379 of file qgslegendsettings.h.

◆ textWidthMillimeters()

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 233 of file qgslegendsettings.cpp.

◆ title()

QString QgsLegendSettings::title ( ) const
inline

Returns the title for the legend, which will be rendered above all legend items.

See also
setTitle()

Definition at line 54 of file qgslegendsettings.h.

◆ titleAlignment()

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

Returns the alignment of the legend title.

See also
setTitleAlignment()

Definition at line 60 of file qgslegendsettings.h.

◆ useAdvancedEffects()

bool QgsLegendSettings::useAdvancedEffects ( ) const
Deprecated:
Use flags from render contexts instead.

Definition at line 128 of file qgslegendsettings.cpp.

◆ wmsLegendSize()

QSizeF QgsLegendSettings::wmsLegendSize ( ) const
inline

Returns the size (in millimeters) of WMS legend graphics shown in the legend.

See also
setWmsLegendSize()

Definition at line 354 of file qgslegendsettings.h.

◆ wrapChar()

QString QgsLegendSettings::wrapChar ( ) const
inline

Returns the string used as a wrapping character.

Whenever this string is encountered inside legend component text it will be automatically replaced with a new line character.

See also
setWrapChar()

Definition at line 123 of file qgslegendsettings.h.


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