33 mSearchMethod =
static_cast< Search >( prj->
readNumEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/SearchMethod" ),
static_cast< int >(
Chain ), &saved ) );
34 mMaxLineCandidatesPerCm = prj->
readDoubleEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/CandidatesLinePerCM" ), 5, &saved );
35 mMaxPolygonCandidatesPerCmSquared = prj->
readDoubleEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/CandidatesPolygonPerCM" ), 2.5, &saved );
37 mFlags = Qgis::LabelingFlags();
47 if ( !prj->
readBoolEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/DrawOutlineLabels" ),
true ) )
50 const int projectTextFormat = prj->
readNumEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/TextFormat" ), -1 );
51 if ( projectTextFormat >= 0 )
61 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/SearchMethod" ),
static_cast< int >( mSearchMethod ) );
62 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/CandidatesLinePerCM" ), mMaxLineCandidatesPerCm );
63 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/CandidatesPolygonPerCM" ), mMaxPolygonCandidatesPerCmSquared );
72 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/TextFormat" ),
static_cast< int >( mDefaultTextRenderFormat ) );
76 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/PlacementEngineVersion" ),
static_cast< int >( mPlacementVersion ) );
81 return mUnplacedLabelColor;
91 return mPlacementVersion;
@ DrawCandidates
Whether to draw rectangles of generated candidates (good for debugging)
@ DrawLabelMetrics
Whether to render label metric guides (for debugging). Since QGIS 3.30.
@ DrawUnplacedLabels
Whether to render unplaced labels as an indicator/warning for users.
@ UseAllLabels
Whether to draw all labels even if there would be collisions.
@ DrawLabelRectOnly
Whether to only draw the label rect and not the actual label text (used for unit tests)
@ UsePartialCandidates
Whether to use also label candidates that are partially outside of the map view.
TextRenderFormat
Flags which control how map layer renderers behave.
@ AlwaysOutlines
Always render text using path objects (AKA outlines/curves). This setting guarantees the best quality...
@ AlwaysText
Always render text as text objects. While this mode preserves text objects as text for post-processin...
LabelPlacementEngineVersion
Labeling placement engine version.
@ Version1
Version 1, matches placement from QGIS <= 3.10.1.
void writeSettingsToProject(QgsProject *project)
Write configuration of the labeling engine to a project.
void setPlacementVersion(Qgis::LabelPlacementEngineVersion version)
Sets the placement engine version, which dictates how the label placement problem is solved.
QgsLabelingEngineSettings()
Search
Search methods in the PAL library to remove colliding labels (methods have different processing speed...
QColor unplacedLabelColor() const
Returns the color to use when rendering unplaced labels.
Qgis::LabelPlacementEngineVersion placementVersion() const
Returns the placement engine version, which dictates how the label placement problem is solved.
void clear()
Returns the configuration to the defaults.
void setUnplacedLabelColor(const QColor &color)
Sets the color to use when rendering unplaced labels.
void readSettingsFromProject(QgsProject *project)
Read configuration of the labeling engine from a project.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
int readNumEntry(const QString &scope, const QString &key, int def=0, bool *ok=nullptr) const
Reads an integer from the specified scope and key.
QString readEntry(const QString &scope, const QString &key, const QString &def=QString(), bool *ok=nullptr) const
Reads a string from the specified scope and key.
bool readBoolEntry(const QString &scope, const QString &key, bool def=false, bool *ok=nullptr) const
Reads a boolean from the specified scope and key.
double readDoubleEntry(const QString &scope, const QString &key, double def=0, bool *ok=nullptr) const
Reads a double from the specified scope and key.
bool writeEntry(const QString &scope, const QString &key, bool value)
Write a boolean value to the project file.
static QColor decodeColor(const QString &str)
static QString encodeColor(const QColor &color)