QGIS API Documentation 3.41.0-Master (d5b93354e9c)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QgsTextBackgroundSettings Class Reference

Container for settings relating to a text background object. More...

#include <qgstextbackgroundsettings.h>

Public Types

enum  RotationType { RotationSync = 0 , RotationOffset , RotationFixed }
 Methods for determining the rotation of the background shape. More...
 
enum  ShapeType {
  ShapeRectangle = 0 , ShapeSquare , ShapeEllipse , ShapeCircle ,
  ShapeSVG , ShapeMarkerSymbol
}
 Background shape types. More...
 
enum  SizeType { SizeBuffer = 0 , SizeFixed , SizePercent }
 Methods for determining the background shape size. More...
 

Public Member Functions

 QgsTextBackgroundSettings ()
 
 QgsTextBackgroundSettings (const QgsTextBackgroundSettings &other)
 
 ~QgsTextBackgroundSettings ()
 
QPainter::CompositionMode blendMode () const
 Returns the blending mode used for drawing the background shape.
 
bool enabled () const
 Returns whether the background is enabled.
 
QColor fillColor () const
 Returns the color used for filing the background shape.
 
QgsFillSymbolfillSymbol () const
 Returns the fill symbol to be rendered in the background.
 
Qt::PenJoinStyle joinStyle () const
 Returns the join style used for drawing the background shape.
 
QgsMarkerSymbolmarkerSymbol () const
 Returns the marker symbol to be rendered in the background.
 
QPointF offset () const
 Returns the offset used for drawing the background shape.
 
QgsMapUnitScale offsetMapUnitScale () const
 Returns the map unit scale object for the shape offset.
 
Qgis::RenderUnit offsetUnit () const
 Returns the units used for the shape's offset.
 
double opacity () const
 Returns the background shape's opacity.
 
bool operator!= (const QgsTextBackgroundSettings &other) const
 
QgsTextBackgroundSettingsoperator= (const QgsTextBackgroundSettings &other)
 
bool operator== (const QgsTextBackgroundSettings &other) const
 
const QgsPaintEffectpaintEffect () const
 Returns the current paint effect for the background shape.
 
QSizeF radii () const
 Returns the radii used for rounding the corners of shapes.
 
QgsMapUnitScale radiiMapUnitScale () const
 Returns the map unit scale object for the shape radii.
 
Qgis::RenderUnit radiiUnit () const
 Returns the units used for the shape's radii.
 
void readFromLayer (QgsVectorLayer *layer)
 Reads settings from a layer's custom properties (for QGIS 2.x projects).
 
void readXml (const QDomElement &elem, const QgsReadWriteContext &context)
 Read settings from a DOM element.
 
QSet< QString > referencedFields (const QgsRenderContext &context) const
 Returns all field names referenced by the configuration (e.g.
 
double rotation () const
 Returns the rotation for the background shape, in degrees clockwise.
 
RotationType rotationType () const
 Returns the method used for rotating the background shape.
 
void setBlendMode (QPainter::CompositionMode mode)
 Sets the blending mode used for drawing the background shape.
 
void setEnabled (bool enabled)
 Sets whether the text background will be drawn.
 
void setFillColor (const QColor &color)
 Sets the color used for filing the background shape.
 
void setFillSymbol (QgsFillSymbol *symbol)
 Sets the current fill symbol for the background shape.
 
void setJoinStyle (Qt::PenJoinStyle style)
 Sets the join style used for drawing the background shape.
 
void setMarkerSymbol (QgsMarkerSymbol *symbol)
 Sets the current marker symbol for the background shape.
 
void setOffset (QPointF offset)
 Sets the offset used for drawing the background shape.
 
void setOffsetMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale object for the shape offset.
 
void setOffsetUnit (Qgis::RenderUnit units)
 Sets the units used for the shape's offset.
 
void setOpacity (double opacity)
 Sets the background shape's opacity.
 
void setPaintEffect (QgsPaintEffect *effect)
 Sets the current paint effect for the background shape.
 
void setRadii (QSizeF radii)
 Sets the radii used for rounding the corners of shapes.
 
void setRadiiMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale object for the shape radii.
 
void setRadiiUnit (Qgis::RenderUnit units)
 Sets the units used for the shape's radii.
 
void setRotation (double rotation)
 Sets the rotation for the background shape, in degrees clockwise.
 
void setRotationType (RotationType type)
 Sets the method used for rotating the background shape.
 
void setSize (QSizeF size)
 Sets the size of the background shape.
 
void setSizeMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale object for the shape size.
 
void setSizeType (SizeType type)
 Sets the method used to determine the size of the background shape (e.g., fixed size or buffer around text).
 
void setSizeUnit (Qgis::RenderUnit unit)
 Sets the units used for the shape's size.
 
void setStrokeColor (const QColor &color)
 Sets the color used for outlining the background shape.
 
void setStrokeWidth (double width)
 Sets the width of the shape's stroke (stroke).
 
void setStrokeWidthMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale object for the shape stroke width.
 
void setStrokeWidthUnit (Qgis::RenderUnit units)
 Sets the units used for the shape's stroke width.
 
void setSvgFile (const QString &file)
 Sets the path to the background SVG file.
 
void setType (ShapeType type)
 Sets the type of background shape to draw (e.g., square, ellipse, SVG).
 
QSizeF size () const
 Returns the size of the background shape.
 
QgsMapUnitScale sizeMapUnitScale () const
 Returns the map unit scale object for the shape size.
 
SizeType sizeType () const
 Returns the method used to determine the size of the background shape (e.g., fixed size or buffer around text).
 
Qgis::RenderUnit sizeUnit () const
 Returns the units used for the shape's size.
 
QColor strokeColor () const
 Returns the color used for outlining the background shape.
 
double strokeWidth () const
 Returns the width of the shape's stroke (stroke).
 
QgsMapUnitScale strokeWidthMapUnitScale () const
 Returns the map unit scale object for the shape stroke width.
 
Qgis::RenderUnit strokeWidthUnit () const
 Returns the units used for the shape's stroke width.
 
QString svgFile () const
 Returns the absolute path to the background SVG file, if set.
 
ShapeType type () const
 Returns the type of background shape (e.g., square, ellipse, SVG).
 
void updateDataDefinedProperties (QgsRenderContext &context, const QgsPropertyCollection &properties)
 Updates the format by evaluating current values of data defined properties.
 
void upgradeDataDefinedProperties (QgsPropertyCollection &properties)
 Upgrade data defined properties when reading a project file saved in QGIS prior to version 3.20.
 
QDomElement writeXml (QDomDocument &doc, const QgsReadWriteContext &context) const
 Write settings into a DOM element.
 

Detailed Description

Container for settings relating to a text background object.

Note
QgsTextBackgroundSettings objects are implicitly shared.

Definition at line 45 of file qgstextbackgroundsettings.h.

Member Enumeration Documentation

◆ RotationType

Methods for determining the rotation of the background shape.

Enumerator
RotationSync 

Shape rotation is synced with text rotation.

RotationOffset 

Shape rotation is offset from text rotation.

RotationFixed 

Shape rotation is a fixed angle.

Definition at line 75 of file qgstextbackgroundsettings.h.

◆ ShapeType

Background shape types.

Enumerator
ShapeRectangle 

Rectangle.

ShapeSquare 

Square - buffered sizes only.

ShapeEllipse 

Ellipse.

ShapeCircle 

Circle.

ShapeSVG 

SVG file.

ShapeMarkerSymbol 

Marker symbol.

Definition at line 52 of file qgstextbackgroundsettings.h.

◆ SizeType

Methods for determining the background shape size.

Enumerator
SizeBuffer 

Shape size is determined by adding a buffer margin around text.

SizeFixed 

Fixed size.

SizePercent 

Shape size is determined by percent of text size.

Definition at line 65 of file qgstextbackgroundsettings.h.

Constructor & Destructor Documentation

◆ QgsTextBackgroundSettings() [1/2]

QgsTextBackgroundSettings::QgsTextBackgroundSettings ( )

Definition at line 29 of file qgstextbackgroundsettings.cpp.

◆ QgsTextBackgroundSettings() [2/2]

QgsTextBackgroundSettings::QgsTextBackgroundSettings ( const QgsTextBackgroundSettings other)

Definition at line 46 of file qgstextbackgroundsettings.cpp.

◆ ~QgsTextBackgroundSettings()

QgsTextBackgroundSettings::~QgsTextBackgroundSettings ( )

Definition at line 58 of file qgstextbackgroundsettings.cpp.

Member Function Documentation

◆ blendMode()

QPainter::CompositionMode QgsTextBackgroundSettings::blendMode ( ) const

Returns the blending mode used for drawing the background shape.

See also
setBlendMode()

Definition at line 298 of file qgstextbackgroundsettings.cpp.

◆ enabled()

bool QgsTextBackgroundSettings::enabled ( ) const

Returns whether the background is enabled.

See also
setEnabled()

Definition at line 110 of file qgstextbackgroundsettings.cpp.

◆ fillColor()

QColor QgsTextBackgroundSettings::fillColor ( ) const

Returns the color used for filing the background shape.

See also
setFillColor()
strokeColor()
Note
As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while other background types should be configured through their symbols.

Definition at line 308 of file qgstextbackgroundsettings.cpp.

◆ fillSymbol()

QgsFillSymbol * QgsTextBackgroundSettings::fillSymbol ( ) const

Returns the fill symbol to be rendered in the background.

Ownership remains with the background settings.

Note
This is only used when the type() is QgsTextBackgroundSettings::ShapeRectangle, QgsTextBackgroundSettings::ShapeSquare, QgsTextBackgroundSettings::ShapeCircle or QgsTextBackgroundSettings::ShapeEllipse
See also
setFillSymbol()
Since
QGIS 3.20

Definition at line 154 of file qgstextbackgroundsettings.cpp.

◆ joinStyle()

Qt::PenJoinStyle QgsTextBackgroundSettings::joinStyle ( ) const

Returns the join style used for drawing the background shape.

See also
setJoinStyle

Definition at line 396 of file qgstextbackgroundsettings.cpp.

◆ markerSymbol()

QgsMarkerSymbol * QgsTextBackgroundSettings::markerSymbol ( ) const

Returns the marker symbol to be rendered in the background.

Ownership remains with the background settings.

Note
This is only used when the type() is QgsTextBackgroundSettings::ShapeMarkerSymbol.
See also
setMarkerSymbol()
Since
QGIS 3.10

Definition at line 140 of file qgstextbackgroundsettings.cpp.

◆ offset()

QPointF QgsTextBackgroundSettings::offset ( ) const

Returns the offset used for drawing the background shape.

Units are determined via offsetUnit().

See also
setOffset()
offsetUnit()

Definition at line 228 of file qgstextbackgroundsettings.cpp.

◆ offsetMapUnitScale()

QgsMapUnitScale QgsTextBackgroundSettings::offsetMapUnitScale ( ) const

Returns the map unit scale object for the shape offset.

This is only used if the offsetUnit() is set to QgsUnitTypes::RenderMapUnit.

See also
setOffsetMapUnitScale()
offsetUnit()

Definition at line 248 of file qgstextbackgroundsettings.cpp.

◆ offsetUnit()

Qgis::RenderUnit QgsTextBackgroundSettings::offsetUnit ( ) const

Returns the units used for the shape's offset.

See also
setOffsetUnit()
offset()

Definition at line 238 of file qgstextbackgroundsettings.cpp.

◆ opacity()

double QgsTextBackgroundSettings::opacity ( ) const

Returns the background shape's opacity.

The opacity is a double value between 0 (fully transparent) and 1 (totally opaque).

See also
setOpacity()

Definition at line 288 of file qgstextbackgroundsettings.cpp.

◆ operator!=()

bool QgsTextBackgroundSettings::operator!= ( const QgsTextBackgroundSettings other) const

Definition at line 105 of file qgstextbackgroundsettings.cpp.

◆ operator=()

QgsTextBackgroundSettings & QgsTextBackgroundSettings::operator= ( const QgsTextBackgroundSettings other)

Definition at line 52 of file qgstextbackgroundsettings.cpp.

◆ operator==()

bool QgsTextBackgroundSettings::operator== ( const QgsTextBackgroundSettings other) const

Definition at line 63 of file qgstextbackgroundsettings.cpp.

◆ paintEffect()

const QgsPaintEffect * QgsTextBackgroundSettings::paintEffect ( ) const

Returns the current paint effect for the background shape.

Returns
paint effect
See also
setPaintEffect()

Definition at line 414 of file qgstextbackgroundsettings.cpp.

◆ radii()

QSizeF QgsTextBackgroundSettings::radii ( ) const

Returns the radii used for rounding the corners of shapes.

Units are retrieved through radiiUnit().

See also
setRadii()
radiiUnit()

Definition at line 258 of file qgstextbackgroundsettings.cpp.

◆ radiiMapUnitScale()

QgsMapUnitScale QgsTextBackgroundSettings::radiiMapUnitScale ( ) const

Returns the map unit scale object for the shape radii.

This is only used if the radiiUnit() is set to QgsUnitTypes::RenderMapUnit.

See also
setRadiiMapUnitScale()
radiiUnit()

Definition at line 278 of file qgstextbackgroundsettings.cpp.

◆ radiiUnit()

Qgis::RenderUnit QgsTextBackgroundSettings::radiiUnit ( ) const

Returns the units used for the shape's radii.

See also
setRadiiUnit()
radii()

Definition at line 268 of file qgstextbackgroundsettings.cpp.

◆ readFromLayer()

void QgsTextBackgroundSettings::readFromLayer ( QgsVectorLayer layer)

Reads settings from a layer's custom properties (for QGIS 2.x projects).

Parameters
layersource vector layer

Definition at line 424 of file qgstextbackgroundsettings.cpp.

◆ readXml()

void QgsTextBackgroundSettings::readXml ( const QDomElement &  elem,
const QgsReadWriteContext context 
)

Read settings from a DOM element.

See also
writeXml()

Definition at line 552 of file qgstextbackgroundsettings.cpp.

◆ referencedFields()

QSet< QString > QgsTextBackgroundSettings::referencedFields ( const QgsRenderContext context) const

Returns all field names referenced by the configuration (e.g.

from data defined properties).

Since
QGIS 3.14

Definition at line 972 of file qgstextbackgroundsettings.cpp.

◆ rotation()

double QgsTextBackgroundSettings::rotation ( ) const

Returns the rotation for the background shape, in degrees clockwise.

See also
rotationType()
setRotation()

Definition at line 218 of file qgstextbackgroundsettings.cpp.

◆ rotationType()

QgsTextBackgroundSettings::RotationType QgsTextBackgroundSettings::rotationType ( ) const

Returns the method used for rotating the background shape.

See also
setRotationType()
rotation()

Definition at line 208 of file qgstextbackgroundsettings.cpp.

◆ setBlendMode()

void QgsTextBackgroundSettings::setBlendMode ( QPainter::CompositionMode  mode)

Sets the blending mode used for drawing the background shape.

Parameters
modeblending mode
See also
blendMode()

Definition at line 303 of file qgstextbackgroundsettings.cpp.

◆ setEnabled()

void QgsTextBackgroundSettings::setEnabled ( bool  enabled)

Sets whether the text background will be drawn.

Parameters
enabledset to true to draw background
See also
enabled()

Definition at line 115 of file qgstextbackgroundsettings.cpp.

◆ setFillColor()

void QgsTextBackgroundSettings::setFillColor ( const QColor &  color)

Sets the color used for filing the background shape.

Parameters
colorbackground color
See also
fillColor()
setStrokeColor()
Note
As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while other background types should be configured through their symbols.

Definition at line 313 of file qgstextbackgroundsettings.cpp.

◆ setFillSymbol()

void QgsTextBackgroundSettings::setFillSymbol ( QgsFillSymbol symbol)

Sets the current fill symbol for the background shape.

Ownership is transferred to the background settings.

Note
This is only used when the type() is QgsTextBackgroundSettings::ShapeRectangle, QgsTextBackgroundSettings::ShapeSquare, QgsTextBackgroundSettings::ShapeCircle or QgsTextBackgroundSettings::ShapeEllipse
See also
fillSymbol()
Since
QGIS 3.20

Definition at line 159 of file qgstextbackgroundsettings.cpp.

◆ setJoinStyle()

void QgsTextBackgroundSettings::setJoinStyle ( Qt::PenJoinStyle  style)

Sets the join style used for drawing the background shape.

Parameters
stylejoin style
See also
joinStyle()
Note
As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while other background types should be configured through their symbols.

Definition at line 405 of file qgstextbackgroundsettings.cpp.

◆ setMarkerSymbol()

void QgsTextBackgroundSettings::setMarkerSymbol ( QgsMarkerSymbol symbol)

Sets the current marker symbol for the background shape.

Ownership is transferred to the background settings.

Note
This is only used when the type() is QgsTextBackgroundSettings::ShapeMarkerSymbol.
See also
markerSymbol()
Since
QGIS 3.10

Definition at line 145 of file qgstextbackgroundsettings.cpp.

◆ setOffset()

void QgsTextBackgroundSettings::setOffset ( QPointF  offset)

Sets the offset used for drawing the background shape.

Units are specified using setOffsetUnit().

Parameters
offsetoffset for shape
See also
offset()
setOffsetUnit()

Definition at line 233 of file qgstextbackgroundsettings.cpp.

◆ setOffsetMapUnitScale()

void QgsTextBackgroundSettings::setOffsetMapUnitScale ( const QgsMapUnitScale scale)

Sets the map unit scale object for the shape offset.

This is only used if the offsetUnit() is set to QgsUnitTypes::RenderMapUnit.

Parameters
scalescale for shape offset
See also
offsetMapUnitScale()
setOffsetUnit()

Definition at line 253 of file qgstextbackgroundsettings.cpp.

◆ setOffsetUnit()

void QgsTextBackgroundSettings::setOffsetUnit ( Qgis::RenderUnit  units)

Sets the units used for the shape's offset.

Parameters
unitsoffset units
See also
offsetUnit()
setOffset()

Definition at line 243 of file qgstextbackgroundsettings.cpp.

◆ setOpacity()

void QgsTextBackgroundSettings::setOpacity ( double  opacity)

Sets the background shape's opacity.

Parameters
opacityopacity as a double value between 0 (fully transparent) and 1 (totally opaque)
See also
opacity()

Definition at line 293 of file qgstextbackgroundsettings.cpp.

◆ setPaintEffect()

void QgsTextBackgroundSettings::setPaintEffect ( QgsPaintEffect effect)

Sets the current paint effect for the background shape.

Parameters
effectpaint effect. Ownership is transferred to the background settings.
See also
paintEffect()

Definition at line 419 of file qgstextbackgroundsettings.cpp.

◆ setRadii()

void QgsTextBackgroundSettings::setRadii ( QSizeF  radii)

Sets the radii used for rounding the corners of shapes.

This is only used if type() is set to QgsTextBackgroundSettings::ShapeRectangle or QgsTextBackgroundSettings::ShapeSquare.

Parameters
radiiQSizeF representing horizontal and vertical radii for rounded corners. Units are specified through setRadiiUnit()
See also
radii()
setRadiiUnit()

Definition at line 263 of file qgstextbackgroundsettings.cpp.

◆ setRadiiMapUnitScale()

void QgsTextBackgroundSettings::setRadiiMapUnitScale ( const QgsMapUnitScale scale)

Sets the map unit scale object for the shape radii.

This is only used if the radiiUnit() is set to QgsUnitTypes::RenderMapUnit.

Parameters
scalescale for shape radii
See also
radiiMapUnitScale()
setRadiiUnit()

Definition at line 283 of file qgstextbackgroundsettings.cpp.

◆ setRadiiUnit()

void QgsTextBackgroundSettings::setRadiiUnit ( Qgis::RenderUnit  units)

Sets the units used for the shape's radii.

Parameters
unitsradii units
See also
radiiUnit()
setRadii()

Definition at line 273 of file qgstextbackgroundsettings.cpp.

◆ setRotation()

void QgsTextBackgroundSettings::setRotation ( double  rotation)

Sets the rotation for the background shape, in degrees clockwise.

See also
rotation()
setRotationType()

Definition at line 223 of file qgstextbackgroundsettings.cpp.

◆ setRotationType()

void QgsTextBackgroundSettings::setRotationType ( QgsTextBackgroundSettings::RotationType  type)

Sets the method used for rotating the background shape.

Parameters
typerotation method
See also
rotationType()
setRotation()

Definition at line 213 of file qgstextbackgroundsettings.cpp.

◆ setSize()

void QgsTextBackgroundSettings::setSize ( QSizeF  size)

Sets the size of the background shape.

The meaning of the size depends on the current sizeType(), e.g., for size types of QgsTextBackgroundSettings::SizeFixed the size will represent the actual width and height of the shape, for QgsTextBackgroundSettings::SizeBuffer the size will represent the horizontal and vertical margins to add to the text when calculating the size of the shape.

Parameters
sizeQSizeF representing horizontal and vertical size components for shape
See also
size()
setSizeType()

Definition at line 183 of file qgstextbackgroundsettings.cpp.

◆ setSizeMapUnitScale()

void QgsTextBackgroundSettings::setSizeMapUnitScale ( const QgsMapUnitScale scale)

Sets the map unit scale object for the shape size.

This is only used if the sizeUnit() is set to QgsUnitTypes::RenderMapUnit.

Parameters
scalescale for shape size
See also
sizeMapUnitScale()
setSizeUnit()

Definition at line 203 of file qgstextbackgroundsettings.cpp.

◆ setSizeType()

void QgsTextBackgroundSettings::setSizeType ( QgsTextBackgroundSettings::SizeType  type)

Sets the method used to determine the size of the background shape (e.g., fixed size or buffer around text).

Parameters
typesize method
See also
sizeType()
setSize()

Definition at line 173 of file qgstextbackgroundsettings.cpp.

◆ setSizeUnit()

void QgsTextBackgroundSettings::setSizeUnit ( Qgis::RenderUnit  unit)

Sets the units used for the shape's size.

This value has no meaning if the sizeType() is set to QgsTextBackgroundSettings::SizePercent.

Parameters
unitsize units
See also
sizeUnit()
setSizeType()
setSize()

Definition at line 193 of file qgstextbackgroundsettings.cpp.

◆ setStrokeColor()

void QgsTextBackgroundSettings::setStrokeColor ( const QColor &  color)

Sets the color used for outlining the background shape.

Parameters
colorstroke color
See also
strokeColor()
setFillColor()

Definition at line 331 of file qgstextbackgroundsettings.cpp.

◆ setStrokeWidth()

void QgsTextBackgroundSettings::setStrokeWidth ( double  width)

Sets the width of the shape's stroke (stroke).

Units are specified through setStrokeWidthUnit().

See also
strokeWidth()
setStrokeWidthUnit()
Note
As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while other background types should be configured through their symbols.

Definition at line 349 of file qgstextbackgroundsettings.cpp.

◆ setStrokeWidthMapUnitScale()

void QgsTextBackgroundSettings::setStrokeWidthMapUnitScale ( const QgsMapUnitScale scale)

Sets the map unit scale object for the shape stroke width.

This is only used if the strokeWidthUnit() is set to QgsUnitTypes::RenderMapUnit.

Parameters
scalescale for shape stroke width
See also
strokeWidthMapUnitScale()
setStrokeWidthUnit()
Note
As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while other background types should be configured through their symbols.

Definition at line 387 of file qgstextbackgroundsettings.cpp.

◆ setStrokeWidthUnit()

void QgsTextBackgroundSettings::setStrokeWidthUnit ( Qgis::RenderUnit  units)

Sets the units used for the shape's stroke width.

Parameters
unitsstroke width units
See also
strokeWidthUnit()
setStrokeWidth()
Note
As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while other background types should be configured through their symbols.

Definition at line 369 of file qgstextbackgroundsettings.cpp.

◆ setSvgFile()

void QgsTextBackgroundSettings::setSvgFile ( const QString &  file)

Sets the path to the background SVG file.

This is only used if type() is set to QgsTextBackgroundSettings::ShapeSVG. The path must be absolute.

Parameters
fileAbsolute SVG file path
See also
svgFile()

Definition at line 135 of file qgstextbackgroundsettings.cpp.

◆ setType()

void QgsTextBackgroundSettings::setType ( QgsTextBackgroundSettings::ShapeType  type)

Sets the type of background shape to draw (e.g., square, ellipse, SVG).

Parameters
typeshape type
See also
type()

Definition at line 125 of file qgstextbackgroundsettings.cpp.

◆ size()

QSizeF QgsTextBackgroundSettings::size ( ) const

Returns the size of the background shape.

The meaning of the size depends on the current sizeType(), e.g., for size types of QgsTextBackgroundSettings::SizeFixed the size will represent the actual width and height of the shape, for QgsTextBackgroundSettings::SizeBuffer the size will represent the horizontal and vertical margins to add to the text when calculating the size of the shape.

See also
setSize()
sizeType()

Definition at line 178 of file qgstextbackgroundsettings.cpp.

◆ sizeMapUnitScale()

QgsMapUnitScale QgsTextBackgroundSettings::sizeMapUnitScale ( ) const

Returns the map unit scale object for the shape size.

This is only used if the sizeUnit() is set to QgsUnitTypes::RenderMapUnit.

See also
setSizeMapUnitScale()
sizeUnit()

Definition at line 198 of file qgstextbackgroundsettings.cpp.

◆ sizeType()

QgsTextBackgroundSettings::SizeType QgsTextBackgroundSettings::sizeType ( ) const

Returns the method used to determine the size of the background shape (e.g., fixed size or buffer around text).

See also
setSizeType()
size()

Definition at line 168 of file qgstextbackgroundsettings.cpp.

◆ sizeUnit()

Qgis::RenderUnit QgsTextBackgroundSettings::sizeUnit ( ) const

Returns the units used for the shape's size.

This value has no meaning if the sizeType() is set to QgsTextBackgroundSettings::SizePercent.

See also
setSizeUnit()
sizeType()
size()

Definition at line 188 of file qgstextbackgroundsettings.cpp.

◆ strokeColor()

QColor QgsTextBackgroundSettings::strokeColor ( ) const

Returns the color used for outlining the background shape.

See also
setStrokeColor()
fillColor()
Note
As of QGIS 3.20, using this function is only recommended for SVG backgrounds, while other background types should be configured through their symbols.

Definition at line 322 of file qgstextbackgroundsettings.cpp.

◆ strokeWidth()

double QgsTextBackgroundSettings::strokeWidth ( ) const

Returns the width of the shape's stroke (stroke).

Units are retrieved through strokeWidthUnit().

See also
setStrokeWidth()
strokeWidthUnit()

Definition at line 340 of file qgstextbackgroundsettings.cpp.

◆ strokeWidthMapUnitScale()

QgsMapUnitScale QgsTextBackgroundSettings::strokeWidthMapUnitScale ( ) const

Returns the map unit scale object for the shape stroke width.

This is only used if the strokeWidthUnit() is set to QgsUnitTypes::RenderMapUnit.

See also
setStrokeWidthMapUnitScale()
strokeWidthUnit()

Definition at line 378 of file qgstextbackgroundsettings.cpp.

◆ strokeWidthUnit()

Qgis::RenderUnit QgsTextBackgroundSettings::strokeWidthUnit ( ) const

Returns the units used for the shape's stroke width.

See also
setStrokeWidthUnit()
strokeWidth()

Definition at line 360 of file qgstextbackgroundsettings.cpp.

◆ svgFile()

QString QgsTextBackgroundSettings::svgFile ( ) const

Returns the absolute path to the background SVG file, if set.

See also
setSvgFile()

Definition at line 130 of file qgstextbackgroundsettings.cpp.

◆ type()

QgsTextBackgroundSettings::ShapeType QgsTextBackgroundSettings::type ( ) const

Returns the type of background shape (e.g., square, ellipse, SVG).

See also
setType()

Definition at line 120 of file qgstextbackgroundsettings.cpp.

◆ updateDataDefinedProperties()

void QgsTextBackgroundSettings::updateDataDefinedProperties ( QgsRenderContext context,
const QgsPropertyCollection properties 
)

Updates the format by evaluating current values of data defined properties.

Note
Since QGIS 3.20, data defined fill color, stroke color, stroke width, and pen join style will only modify SVG backgrounds. For other background types, the data defined properties within symbols are to be used.
Since
QGIS 3.10

Definition at line 790 of file qgstextbackgroundsettings.cpp.

◆ upgradeDataDefinedProperties()

void QgsTextBackgroundSettings::upgradeDataDefinedProperties ( QgsPropertyCollection properties)

Upgrade data defined properties when reading a project file saved in QGIS prior to version 3.20.

Since
QGIS 3.20

Definition at line 752 of file qgstextbackgroundsettings.cpp.

◆ writeXml()

QDomElement QgsTextBackgroundSettings::writeXml ( QDomDocument &  doc,
const QgsReadWriteContext context 
) const

Write settings into a DOM element.

See also
readXml()

Definition at line 711 of file qgstextbackgroundsettings.cpp.


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