QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
27 d =
new QgsTextBackgroundSettingsPrivate();
79 return d->markerSymbol.get();
84 d->markerSymbol.reset( symbol );
119 return d->sizeMapUnitScale;
124 d->sizeMapUnitScale = scale;
129 return d->rotationType;
134 d->rotationType =
type;
159 return d->offsetUnits;
164 d->offsetUnits = units;
169 return d->offsetMapUnitScale;
174 d->offsetMapUnitScale = scale;
189 return d->radiiUnits;
194 d->radiiUnits = units;
199 return d->radiiMapUnitScale;
204 d->radiiMapUnitScale = scale;
234 d->fillColor = color;
239 return d->strokeColor;
244 d->strokeColor = color;
249 return d->strokeWidth;
254 d->strokeWidth = width;
259 return d->strokeWidthUnits;
264 d->strokeWidthUnits = units;
269 return d->strokeWidthMapUnitScale;
274 d->strokeWidthMapUnitScale = scale;
284 d->joinStyle = style;
289 return d->paintEffect.get();
294 d->paintEffect.reset( effect );
299 d->enabled = layer->
customProperty( QStringLiteral(
"labeling/shapeDraw" ), QVariant(
false ) ).toBool();
301 d->svgFile = layer->
customProperty( QStringLiteral(
"labeling/shapeSVGFile" ), QVariant(
"" ) ).toString();
303 d->size = QSizeF( layer->
customProperty( QStringLiteral(
"labeling/shapeSizeX" ), QVariant( 0.0 ) ).toDouble(),
304 layer->
customProperty( QStringLiteral(
"labeling/shapeSizeY" ), QVariant( 0.0 ) ).toDouble() );
306 if ( layer->
customProperty( QStringLiteral(
"labeling/shapeSizeUnit" ) ).toString().isEmpty() )
315 if ( layer->
customProperty( QStringLiteral(
"labeling/shapeSizeMapUnitScale" ) ).toString().isEmpty() )
318 double oldMin = layer->
customProperty( QStringLiteral(
"labeling/shapeSizeMapUnitMinScale" ), 0.0 ).toDouble();
319 d->sizeMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
320 double oldMax = layer->
customProperty( QStringLiteral(
"labeling/shapeSizeMapUnitMaxScale" ), 0.0 ).toDouble();
321 d->sizeMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
328 d->rotation = layer->
customProperty( QStringLiteral(
"labeling/shapeRotation" ), QVariant( 0.0 ) ).toDouble();
329 d->offset = QPointF( layer->
customProperty( QStringLiteral(
"labeling/shapeOffsetX" ), QVariant( 0.0 ) ).toDouble(),
330 layer->
customProperty( QStringLiteral(
"labeling/shapeOffsetY" ), QVariant( 0.0 ) ).toDouble() );
332 if ( layer->
customProperty( QStringLiteral(
"labeling/shapeOffsetUnit" ) ).toString().isEmpty() )
341 if ( layer->
customProperty( QStringLiteral(
"labeling/shapeOffsetMapUnitScale" ) ).toString().isEmpty() )
344 double oldMin = layer->
customProperty( QStringLiteral(
"labeling/shapeOffsetMapUnitMinScale" ), 0.0 ).toDouble();
345 d->offsetMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
346 double oldMax = layer->
customProperty( QStringLiteral(
"labeling/shapeOffsetMapUnitMaxScale" ), 0.0 ).toDouble();
347 d->offsetMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
353 d->radii = QSizeF( layer->
customProperty( QStringLiteral(
"labeling/shapeRadiiX" ), QVariant( 0.0 ) ).toDouble(),
354 layer->
customProperty( QStringLiteral(
"labeling/shapeRadiiY" ), QVariant( 0.0 ) ).toDouble() );
357 if ( layer->
customProperty( QStringLiteral(
"labeling/shapeRadiiUnit" ) ).toString().isEmpty() )
366 if ( layer->
customProperty( QStringLiteral(
"labeling/shapeRadiiMapUnitScale" ) ).toString().isEmpty() )
369 double oldMin = layer->
customProperty( QStringLiteral(
"labeling/shapeRadiiMapUnitMinScale" ), 0.0 ).toDouble();
370 d->radiiMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
371 double oldMax = layer->
customProperty( QStringLiteral(
"labeling/shapeRadiiMapUnitMaxScale" ), 0.0 ).toDouble();
372 d->radiiMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
380 d->strokeWidth = layer->
customProperty( QStringLiteral(
"labeling/shapeBorderWidth" ), QVariant( .0 ) ).toDouble();
381 if ( layer->
customProperty( QStringLiteral(
"labeling/shapeBorderWidthUnit" ) ).toString().isEmpty() )
389 if ( layer->
customProperty( QStringLiteral(
"labeling/shapeBorderWidthMapUnitScale" ) ).toString().isEmpty() )
392 double oldMin = layer->
customProperty( QStringLiteral(
"labeling/shapeBorderWidthMapUnitMinScale" ), 0.0 ).toDouble();
393 d->strokeWidthMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
394 double oldMax = layer->
customProperty( QStringLiteral(
"labeling/shapeBorderWidthMapUnitMaxScale" ), 0.0 ).toDouble();
395 d->strokeWidthMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
401 d->joinStyle =
static_cast< Qt::PenJoinStyle
>( layer->
customProperty( QStringLiteral(
"labeling/shapeJoinStyle" ), QVariant( Qt::BevelJoin ) ).toUInt() );
403 if ( layer->
customProperty( QStringLiteral(
"labeling/shapeOpacity" ) ).toString().isEmpty() )
405 d->opacity = ( 1 - layer->
customProperty( QStringLiteral(
"labeling/shapeTransparency" ) ).toInt() / 100.0 );
409 d->opacity = ( layer->
customProperty( QStringLiteral(
"labeling/shapeOpacity" ) ).toDouble() );
414 if ( layer->
customProperty( QStringLiteral(
"labeling/shapeEffect" ) ).isValid() )
416 QDomDocument doc( QStringLiteral(
"effect" ) );
417 doc.setContent( layer->
customProperty( QStringLiteral(
"labeling/shapeEffect" ) ).toString() );
418 QDomElement effectElem = doc.firstChildElement( QStringLiteral(
"effect" ) ).firstChildElement( QStringLiteral(
"effect" ) );
427 QDomElement backgroundElem = elem.firstChildElement( QStringLiteral(
"background" ) );
428 d->enabled = backgroundElem.attribute( QStringLiteral(
"shapeDraw" ), QStringLiteral(
"0" ) ).toInt();
429 d->type =
static_cast< ShapeType >( backgroundElem.attribute( QStringLiteral(
"shapeType" ), QString::number(
ShapeRectangle ) ).toUInt() );
431 d->sizeType =
static_cast< SizeType >( backgroundElem.attribute( QStringLiteral(
"shapeSizeType" ), QString::number(
SizeBuffer ) ).toUInt() );
432 d->size = QSizeF( backgroundElem.attribute( QStringLiteral(
"shapeSizeX" ), QStringLiteral(
"0" ) ).toDouble(),
433 backgroundElem.attribute( QStringLiteral(
"shapeSizeY" ), QStringLiteral(
"0" ) ).toDouble() );
435 if ( !backgroundElem.hasAttribute( QStringLiteral(
"shapeSizeUnit" ) ) )
444 if ( !backgroundElem.hasAttribute( QStringLiteral(
"shapeSizeMapUnitScale" ) ) )
447 double oldMin = backgroundElem.attribute( QStringLiteral(
"shapeSizeMapUnitMinScale" ), QStringLiteral(
"0" ) ).toDouble();
448 d->sizeMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
449 double oldMax = backgroundElem.attribute( QStringLiteral(
"shapeSizeMapUnitMaxScale" ), QStringLiteral(
"0" ) ).toDouble();
450 d->sizeMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
456 d->rotationType =
static_cast< RotationType >( backgroundElem.attribute( QStringLiteral(
"shapeRotationType" ), QString::number(
RotationSync ) ).toUInt() );
457 d->rotation = backgroundElem.attribute( QStringLiteral(
"shapeRotation" ), QStringLiteral(
"0" ) ).toDouble();
458 d->offset = QPointF( backgroundElem.attribute( QStringLiteral(
"shapeOffsetX" ), QStringLiteral(
"0" ) ).toDouble(),
459 backgroundElem.attribute( QStringLiteral(
"shapeOffsetY" ), QStringLiteral(
"0" ) ).toDouble() );
461 if ( !backgroundElem.hasAttribute( QStringLiteral(
"shapeOffsetUnit" ) ) )
470 if ( !backgroundElem.hasAttribute( QStringLiteral(
"shapeOffsetMapUnitScale" ) ) )
473 double oldMin = backgroundElem.attribute( QStringLiteral(
"shapeOffsetMapUnitMinScale" ), QStringLiteral(
"0" ) ).toDouble();
474 d->offsetMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
475 double oldMax = backgroundElem.attribute( QStringLiteral(
"shapeOffsetMapUnitMaxScale" ), QStringLiteral(
"0" ) ).toDouble();
476 d->offsetMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
482 d->radii = QSizeF( backgroundElem.attribute( QStringLiteral(
"shapeRadiiX" ), QStringLiteral(
"0" ) ).toDouble(),
483 backgroundElem.attribute( QStringLiteral(
"shapeRadiiY" ), QStringLiteral(
"0" ) ).toDouble() );
485 if ( !backgroundElem.hasAttribute( QStringLiteral(
"shapeRadiiUnit" ) ) )
493 if ( !backgroundElem.hasAttribute( QStringLiteral(
"shapeRadiiMapUnitScale" ) ) )
496 double oldMin = backgroundElem.attribute( QStringLiteral(
"shapeRadiiMapUnitMinScale" ), QStringLiteral(
"0" ) ).toDouble();
497 d->radiiMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
498 double oldMax = backgroundElem.attribute( QStringLiteral(
"shapeRadiiMapUnitMaxScale" ), QStringLiteral(
"0" ) ).toDouble();
499 d->radiiMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
507 d->strokeWidth = backgroundElem.attribute( QStringLiteral(
"shapeBorderWidth" ), QStringLiteral(
"0" ) ).toDouble();
509 if ( !backgroundElem.hasAttribute( QStringLiteral(
"shapeBorderWidthUnit" ) ) )
517 if ( !backgroundElem.hasAttribute( QStringLiteral(
"shapeBorderWidthMapUnitScale" ) ) )
520 double oldMin = backgroundElem.attribute( QStringLiteral(
"shapeBorderWidthMapUnitMinScale" ), QStringLiteral(
"0" ) ).toDouble();
521 d->strokeWidthMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
522 double oldMax = backgroundElem.attribute( QStringLiteral(
"shapeBorderWidthMapUnitMaxScale" ), QStringLiteral(
"0" ) ).toDouble();
523 d->strokeWidthMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
529 d->joinStyle =
static_cast< Qt::PenJoinStyle
>( backgroundElem.attribute( QStringLiteral(
"shapeJoinStyle" ), QString::number( Qt::BevelJoin ) ).toUInt() );
531 if ( !backgroundElem.hasAttribute( QStringLiteral(
"shapeOpacity" ) ) )
533 d->opacity = ( 1 - backgroundElem.attribute( QStringLiteral(
"shapeTransparency" ) ).toInt() / 100.0 );
537 d->opacity = ( backgroundElem.attribute( QStringLiteral(
"shapeOpacity" ) ).toDouble() );
543 QDomElement effectElem = backgroundElem.firstChildElement( QStringLiteral(
"effect" ) );
544 if ( !effectElem.isNull() )
549 const QDomElement symbolElem = backgroundElem.firstChildElement( QStringLiteral(
"symbol" ) );
550 if ( !symbolElem.isNull() )
551 setMarkerSymbol( QgsSymbolLayerUtils::loadSymbol< QgsMarkerSymbol >( symbolElem, context ) );
558 QDomElement backgroundElem = doc.createElement( QStringLiteral(
"background" ) );
559 backgroundElem.setAttribute( QStringLiteral(
"shapeDraw" ), d->enabled );
560 backgroundElem.setAttribute( QStringLiteral(
"shapeType" ),
static_cast< unsigned int >( d->type ) );
562 backgroundElem.setAttribute( QStringLiteral(
"shapeSizeType" ),
static_cast< unsigned int >( d->sizeType ) );
563 backgroundElem.setAttribute( QStringLiteral(
"shapeSizeX" ), d->size.width() );
564 backgroundElem.setAttribute( QStringLiteral(
"shapeSizeY" ), d->size.height() );
567 backgroundElem.setAttribute( QStringLiteral(
"shapeRotationType" ),
static_cast< unsigned int >( d->rotationType ) );
568 backgroundElem.setAttribute( QStringLiteral(
"shapeRotation" ), d->rotation );
569 backgroundElem.setAttribute( QStringLiteral(
"shapeOffsetX" ), d->offset.x() );
570 backgroundElem.setAttribute( QStringLiteral(
"shapeOffsetY" ), d->offset.y() );
573 backgroundElem.setAttribute( QStringLiteral(
"shapeRadiiX" ), d->radii.width() );
574 backgroundElem.setAttribute( QStringLiteral(
"shapeRadiiY" ), d->radii.height() );
579 backgroundElem.setAttribute( QStringLiteral(
"shapeBorderWidth" ), d->strokeWidth );
580 backgroundElem.setAttribute( QStringLiteral(
"shapeBorderWidthUnit" ),
QgsUnitTypes::encodeUnit( d->strokeWidthUnits ) );
582 backgroundElem.setAttribute( QStringLiteral(
"shapeJoinStyle" ),
static_cast< unsigned int >( d->joinStyle ) );
583 backgroundElem.setAttribute( QStringLiteral(
"shapeOpacity" ), d->opacity );
586 d->paintEffect->saveProperties( doc, backgroundElem );
588 if ( d->markerSymbol )
591 return backgroundElem;
614 if ( exprVal.isValid() )
616 QString units = exprVal.toString();
617 if ( !units.isEmpty() )
627 if ( exprVal.isValid() )
629 const QString skind = exprVal.toString().trimmed();
630 if ( !skind.isEmpty() )
637 if ( exprVal.isValid() )
639 QString stype = exprVal.toString().trimmed();
640 if ( !stype.isEmpty() )
649 if ( exprVal.isValid() )
651 QString svgfile = exprVal.toString().trimmed();
661 if ( exprVal.isValid() )
663 QString rotstr = exprVal.toString().trimmed();
664 if ( !rotstr.isEmpty() )
671 if ( exprVal.isValid() )
681 if ( exprVal.isValid() )
683 QString units = exprVal.toString();
684 if ( !units.isEmpty() )
689 d->offsetUnits = res;
694 if ( exprVal.isValid() )
705 if ( exprVal.isValid() )
707 QString units = exprVal.toString();
708 if ( !units.isEmpty() )
740 if ( exprVal.isValid() )
742 QString units = exprVal.toString();
743 if ( !units.isEmpty() )
748 d->strokeWidthUnits = res;
755 QString blendstr = exprVal.toString().trimmed();
756 if ( !blendstr.isEmpty() )
763 QString joinstr = exprVal.toString().trimmed();
764 if ( !joinstr.isEmpty() )
773 QSet< QString > fields;
774 if ( d->markerSymbol )
776 fields.unite( d->markerSymbol->usedAttributes( context ) );
void setStrokeColor(const QColor &color)
Sets the color used for outlining the background shape.
static QgsTextBackgroundSettings::SizeType decodeBackgroundSizeType(const QString &string)
Decodes a string representation of a background size type to a type.
double valueAsDouble(int key, const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a double.
static QString encodeColor(const QColor &color)
static QPainter::CompositionMode decodeBlendMode(const QString &s)
void setRotationType(RotationType type)
Sets the method used for rotating the background shape.
QgsUnitTypes::RenderUnit radiiUnit() const
Returns the units used for the shape's radii.
RenderUnit
Rendering size units.
QgsExpressionContext & expressionContext()
Gets the expression context.
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer.
bool enabled() const
Returns whether the background is enabled.
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
void setSizeType(SizeType type)
Sets the method used to determine the size of the background shape (e.g., fixed size or buffer around...
~QgsTextBackgroundSettings()
void setStrokeWidth(double width)
Sets the width of the shape's stroke (stroke).
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style used for drawing the background shape.
static QgsTextBackgroundSettings::RotationType decodeBackgroundRotationType(const QString &string)
Decodes a string representation of a background rotation type to a type.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape stroke width.
QgsMapUnitScale offsetMapUnitScale() const
Returns the map unit scale object for the shape offset.
void setRadiiMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape radii.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
QSet< QString > referencedFields(const QgsRenderContext &context) const
Returns all field names referenced by the configuration (e.g.
void setMarkerSymbol(QgsMarkerSymbol *symbol)
Sets the current marker symbol for the background shape.
QColor fillColor() const
Returns the color used for filing the background shape.
SizeType
Methods for determining the background shape size.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Write settings into a DOM element.
@ RotationSync
Shape rotation is synced with text rotation.
QPointF offset() const
Returns the offset used for drawing the background shape.
static QColor readColor(QgsVectorLayer *layer, const QString &property, const QColor &defaultColor=Qt::black, bool withAlpha=true)
Converts an encoded color value from a layer property.
QgsMapUnitScale strokeWidthMapUnitScale() const
Returns the map unit scale object for the shape stroke width.
void readFromLayer(QgsVectorLayer *layer)
Reads settings from a layer's custom properties (for QGIS 2.x projects).
double opacity() const
Returns the background shape's opacity.
static QSizeF toSize(const QVariant &value, bool *ok=nullptr)
Converts a value to a size.
@ ShapeOpacity
Shape opacity.
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the units used for the shape's stroke width.
static QString svgSymbolPathToName(const QString &path, const QgsPathResolver &pathResolver)
Determines an SVG symbol's name from its path.
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the background shape.
static QColor decodeColor(const QString &str)
void setOpacity(double opacity)
Sets the background shape's opacity.
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shape's stroke width.
SizeType sizeType() const
Returns the method used to determine the size of the background shape (e.g., fixed size or buffer aro...
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing the background shape.
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape size.
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the background shape.
static Q_INVOKABLE QgsUnitTypes::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
static QgsPainting::BlendMode getBlendModeEnum(QPainter::CompositionMode blendMode)
Returns a BlendMode corresponding to a QPainter::CompositionMode.
void setRadiiUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shape's radii.
static QPointF toPoint(const QVariant &value, bool *ok=nullptr)
Converts a value to a point.
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the shape size.
RotationType rotationType() const
Returns the method used for rotating the background shape.
RotationType
Methods for determining the rotation of the background shape.
QSizeF size() const
Returns the size of the background shape.
static bool isDefaultStack(QgsPaintEffect *effect)
Tests whether a paint effect matches the default effects stack.
void setOffset(QPointF offset)
Sets the offset used for drawing the background shape.
@ ShapeRectangle
Rectangle.
Qt::PenJoinStyle joinStyle() const
Returns the join style used for drawing the background shape.
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
static QgsTextBackgroundSettings::ShapeType decodeShapeType(const QString &string)
Decodes a string representation of a background shape type to a type.
double strokeWidth() const
Returns the width of the shape's stroke (stroke).
static QPainter::CompositionMode getCompositionMode(QgsPainting::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the background shape.
void updateDataDefinedProperties(QgsRenderContext &context, const QgsPropertyCollection &properties)
Updates the format by evaluating current values of data defined properties.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the shape offset.
@ SizeBuffer
Shape size is determined by adding a buffer margin around text.
double rotation() const
Returns the rotation for the background shape, in degrees clockwise.
Struct for storing maximum and minimum scales for measurements in map units.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Read settings from a DOM element.
QgsMapUnitScale radiiMapUnitScale() const
Returns the map unit scale object for the shape radii.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the shape's size.
ShapeType type() const
Returns the type of background shape (e.g., square, ellipse, SVG).
QString svgFile() const
Returns the absolute path to the background SVG file, if set.
void setFillColor(const QColor &color)
Sets the color used for filing the background shape.
QgsTextBackgroundSettings()
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
void setRadii(QSizeF radii)
Sets the radii used for rounding the corners of shapes.
void setType(ShapeType type)
Sets the type of background shape to draw (e.g., square, ellipse, SVG).
Q_INVOKABLE QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
static QgsPaintEffectRegistry * paintEffectRegistry()
Returns the application's paint effect registry, used for managing paint effects.
QVariant value(int key, const QgsExpressionContext &context, const QVariant &defaultValue=QVariant()) const override
Returns the calculated value of the property with the specified key from within the collection.
bool valueAsBool(int key, const QgsExpressionContext &context, bool defaultValue=false, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as an boolean.
static QString svgSymbolNameToPath(const QString &name, const QgsPathResolver &pathResolver)
Determines an SVG symbol's path from its name.
Base class for visual effects which can be applied to QPicture drawings.
ShapeType
Background shape types.
const QgsPathResolver & pathResolver() const
Returns the path resolver for conversion between relative and absolute paths during rendering operati...
void setSvgFile(const QString &file)
Sets the path to the background SVG file.
static Qt::PenJoinStyle decodePenJoinStyle(const QString &str)
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units used for the shape's size.
QgsTextBackgroundSettings & operator=(const QgsTextBackgroundSettings &other)
void setSize(QSizeF size)
Sets the size of the background shape.
void setRotation(double rotation)
Sets the rotation for the background shape, in degrees clockwise.
QgsMarkerSymbol * markerSymbol() const
Returns the marker symbol to be rendered in the background.
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
static QgsUnitTypes::RenderUnit convertFromOldLabelUnit(int val)
Converts a unit from an old (pre 3.0) label unit.
void setOffsetUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shape's offset.
static QDomElement saveSymbol(const QString &symbolName, const QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
QColor strokeColor() const
Returns the color used for outlining the background shape.
void setEnabled(bool enabled)
Sets whether the text background will be drawn.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units used for the shape's offset.
QSizeF radii() const
Returns the radii used for rounding the corners of shapes.
QColor valueAsColor(int key, const QgsExpressionContext &context, const QColor &defaultColor=QColor(), bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a color.
const QgsPathResolver & pathResolver() const
Returns path resolver for conversion between relative and absolute paths.