QgsLabelingEngineSettings class

Stores global configuration for labeling engine.

Contents

Public types

enum Flag { UseAllLabels = 1 << 1, UsePartialCandidates = 1 << 2, RenderOutlineLabels = 1 << 3, DrawLabelRectOnly = 1 << 4, DrawCandidates = 1 << 5 }
Various flags that affect drawing and placement of labels.
enum Search { Chain, Popmusic_Tabu, Popmusic_Chain, Popmusic_Tabu_Chain, Falp }
Search methods in the PAL library to remove colliding labels (methods have different processing speed and number of labels placed)

Public functions

void clear()
Returns the configuration to the defaults.
auto defaultTextRenderFormat() const -> QgsRenderContext::TextRenderFormat
Returns the default text rendering format for the labels.
auto flags() const -> Flags
Gets flags of the labeling engine.
void numCandidatePositions(int& candPoint, int& candLine, int& candPolygon) const
Gets number of candidate positions that will be generated for each label feature (default to 8)
void readSettingsFromProject(QgsProject* project)
Read configuration of the labeling engine from a project.
auto searchMethod() const -> Search
Which search method to use for removal collisions between labels.
void setDefaultTextRenderFormat(QgsRenderContext::TextRenderFormat format)
Sets the default text rendering format for the labels.
void setFlag(Flag f, bool enabled = true)
Sets whether a particual flag is enabled.
void setFlags(Flags flags)
Sets flags of the labeling engine.
void setNumCandidatePositions(int candPoint, int candLine, int candPolygon)
Sets number of candidate positions that will be generated for each label feature.
void setSearchMethod(Search s)
Sets which search method to use for removal collisions between labels.
auto testFlag(Flag f) const -> bool
Test whether a particular flag is enabled.
void writeSettingsToProject(QgsProject* project)
Write configuration of the labeling engine to a project.

Enum documentation

enum QgsLabelingEngineSettings::Flag

Various flags that affect drawing and placement of labels.

Enumerators
UseAllLabels

Whether to draw all labels even if there would be collisions.

UsePartialCandidates

Whether to use also label candidates that are partially outside of the map view.

RenderOutlineLabels

Whether to render labels as text or outlines. Deprecated and of QGIS 3.4.3 - use defaultTextRenderFormat() instead.

DrawLabelRectOnly

Whether to only draw the label rect and not the actual label text (used for unit tests)

DrawCandidates

Whether to draw rectangles of generated candidates (good for debugging)

Function documentation

QgsRenderContext::TextRenderFormat QgsLabelingEngineSettings::defaultTextRenderFormat() const

Returns the default text rendering format for the labels.

void QgsLabelingEngineSettings::setDefaultTextRenderFormat(QgsRenderContext::TextRenderFormat format)

Sets the default text rendering format for the labels.