QGIS API Documentation
3.10.0-A Coruña (6c816b4204)
|
Container for settings relating to a text background object. More...
#include <qgstextrenderer.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) | |
Copy constructor. More... | |
~QgsTextBackgroundSettings () | |
QPainter::CompositionMode | blendMode () const |
Returns the blending mode used for drawing the background shape. More... | |
bool | enabled () const |
Returns whether the background is enabled. More... | |
QColor | fillColor () const |
Returns the color used for filing the background shape. More... | |
Qt::PenJoinStyle | joinStyle () const |
Returns the join style used for drawing the background shape. More... | |
QgsMarkerSymbol * | markerSymbol () const |
Returns the marker symbol to be rendered in the background. More... | |
QPointF | offset () const |
Returns the offset used for drawing the background shape. More... | |
QgsMapUnitScale | offsetMapUnitScale () const |
Returns the map unit scale object for the shape offset. More... | |
QgsUnitTypes::RenderUnit | offsetUnit () const |
Returns the units used for the shape's offset. More... | |
double | opacity () const |
Returns the background shape's opacity. More... | |
QgsTextBackgroundSettings & | operator= (const QgsTextBackgroundSettings &other) |
QgsPaintEffect * | paintEffect () const |
Returns the current paint effect for the background shape. More... | |
QSizeF | radii () const |
Returns the radii used for rounding the corners of shapes. More... | |
QgsMapUnitScale | radiiMapUnitScale () const |
Returns the map unit scale object for the shape radii. More... | |
QgsUnitTypes::RenderUnit | radiiUnit () const |
Returns the units used for the shape's radii. More... | |
void | readFromLayer (QgsVectorLayer *layer) |
Reads settings from a layer's custom properties (for QGIS 2.x projects). More... | |
void | readXml (const QDomElement &elem, const QgsReadWriteContext &context) |
Read settings from a DOM element. More... | |
double | rotation () const |
Returns the rotation for the background shape, in degrees clockwise. More... | |
RotationType | rotationType () const |
Returns the method used for rotating the background shape. More... | |
void | setBlendMode (QPainter::CompositionMode mode) |
Sets the blending mode used for drawing the background shape. More... | |
void | setEnabled (bool enabled) |
Sets whether the text background will be drawn. More... | |
void | setFillColor (const QColor &color) |
Sets the color used for filing the background shape. More... | |
void | setJoinStyle (Qt::PenJoinStyle style) |
Sets the join style used for drawing the background shape. More... | |
void | setMarkerSymbol (QgsMarkerSymbol *symbol) |
Sets the current marker symbol for the background shape. More... | |
void | setOffset (QPointF offset) |
Sets the offset used for drawing the background shape. More... | |
void | setOffsetMapUnitScale (const QgsMapUnitScale &scale) |
Sets the map unit scale object for the shape offset. More... | |
void | setOffsetUnit (QgsUnitTypes::RenderUnit units) |
Sets the units used for the shape's offset. More... | |
void | setOpacity (double opacity) |
Sets the background shape's opacity. More... | |
void | setPaintEffect (QgsPaintEffect *effect) |
Sets the current paint effect for the background shape. More... | |
void | setRadii (QSizeF radii) |
Sets the radii used for rounding the corners of shapes. More... | |
void | setRadiiMapUnitScale (const QgsMapUnitScale &scale) |
Sets the map unit scale object for the shape radii. More... | |
void | setRadiiUnit (QgsUnitTypes::RenderUnit units) |
Sets the units used for the shape's radii. More... | |
void | setRotation (double rotation) |
Sets the rotation for the background shape, in degrees clockwise. More... | |
void | setRotationType (RotationType type) |
Sets the method used for rotating the background shape. More... | |
void | setSize (QSizeF size) |
Sets the size of the background shape. More... | |
void | setSizeMapUnitScale (const QgsMapUnitScale &scale) |
Sets the map unit scale object for the shape size. More... | |
void | setSizeType (SizeType type) |
Sets the method used to determine the size of the background shape (e.g., fixed size or buffer around text). More... | |
void | setSizeUnit (QgsUnitTypes::RenderUnit unit) |
Sets the units used for the shape's size. More... | |
void | setStrokeColor (const QColor &color) |
Sets the color used for outlining the background shape. More... | |
void | setStrokeWidth (double width) |
Sets the width of the shape's stroke (stroke). More... | |
void | setStrokeWidthMapUnitScale (const QgsMapUnitScale &scale) |
Sets the map unit scale object for the shape stroke width. More... | |
void | setStrokeWidthUnit (QgsUnitTypes::RenderUnit units) |
Sets the units used for the shape's stroke width. More... | |
void | setSvgFile (const QString &file) |
Sets the path to the background SVG file. More... | |
void | setType (ShapeType type) |
Sets the type of background shape to draw (e.g., square, ellipse, SVG). More... | |
QSizeF | size () const |
Returns the size of the background shape. More... | |
QgsMapUnitScale | sizeMapUnitScale () const |
Returns the map unit scale object for the shape size. More... | |
SizeType | sizeType () const |
Returns the method used to determine the size of the background shape (e.g., fixed size or buffer around text). More... | |
QgsUnitTypes::RenderUnit | sizeUnit () const |
Returns the units used for the shape's size. More... | |
QColor | strokeColor () const |
Returns the color used for outlining the background shape. More... | |
double | strokeWidth () const |
Returns the width of the shape's stroke (stroke). More... | |
QgsMapUnitScale | strokeWidthMapUnitScale () const |
Returns the map unit scale object for the shape stroke width. More... | |
QgsUnitTypes::RenderUnit | strokeWidthUnit () const |
Returns the units used for the shape's stroke width. More... | |
QString | svgFile () const |
Returns the absolute path to the background SVG file, if set. More... | |
ShapeType | type () const |
Returns the type of background shape (e.g., square, ellipse, SVG). More... | |
void | updateDataDefinedProperties (QgsRenderContext &context, const QgsPropertyCollection &properties) |
Updates the format by evaluating current values of data defined properties. More... | |
QDomElement | writeXml (QDomDocument &doc, const QgsReadWriteContext &context) const |
Write settings into a DOM element. More... | |
Container for settings relating to a text background object.
Definition at line 249 of file qgstextrenderer.h.
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 279 of file qgstextrenderer.h.
Background shape types.
Enumerator | |
---|---|
ShapeRectangle | Rectangle. |
ShapeSquare | Square - buffered sizes only. |
ShapeEllipse | Ellipse. |
ShapeCircle | Circle. |
ShapeSVG | SVG file. |
ShapeMarkerSymbol | Marker symbol. |
Definition at line 256 of file qgstextrenderer.h.
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 269 of file qgstextrenderer.h.
QgsTextBackgroundSettings::QgsTextBackgroundSettings | ( | ) |
Definition at line 408 of file qgstextrenderer.cpp.
QgsTextBackgroundSettings::QgsTextBackgroundSettings | ( | const QgsTextBackgroundSettings & | other | ) |
Copy constructor.
other | source QgsTextBackgroundSettings |
Definition at line 413 of file qgstextrenderer.cpp.
QgsTextBackgroundSettings::~QgsTextBackgroundSettings | ( | ) |
Definition at line 425 of file qgstextrenderer.cpp.
QPainter::CompositionMode QgsTextBackgroundSettings::blendMode | ( | ) | const |
Returns the blending mode used for drawing the background shape.
Definition at line 600 of file qgstextrenderer.cpp.
bool QgsTextBackgroundSettings::enabled | ( | ) | const |
Returns whether the background is enabled.
Definition at line 430 of file qgstextrenderer.cpp.
QColor QgsTextBackgroundSettings::fillColor | ( | ) | const |
Returns the color used for filing the background shape.
Definition at line 610 of file qgstextrenderer.cpp.
Qt::PenJoinStyle QgsTextBackgroundSettings::joinStyle | ( | ) | const |
Returns the join style used for drawing the background shape.
Definition at line 660 of file qgstextrenderer.cpp.
QgsMarkerSymbol * QgsTextBackgroundSettings::markerSymbol | ( | ) | const |
Returns the marker symbol to be rendered in the background.
Ownership remains with the background settings.
Definition at line 460 of file qgstextrenderer.cpp.
QPointF QgsTextBackgroundSettings::offset | ( | ) | const |
Returns the offset used for drawing the background shape.
Units are determined via offsetUnit().
Definition at line 530 of file qgstextrenderer.cpp.
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.
Definition at line 550 of file qgstextrenderer.cpp.
QgsUnitTypes::RenderUnit QgsTextBackgroundSettings::offsetUnit | ( | ) | const |
Returns the units used for the shape's offset.
Definition at line 540 of file qgstextrenderer.cpp.
double QgsTextBackgroundSettings::opacity | ( | ) | const |
Returns the background shape's opacity.
The opacity is a double value between 0 (fully transparent) and 1 (totally opaque).
Definition at line 590 of file qgstextrenderer.cpp.
QgsTextBackgroundSettings & QgsTextBackgroundSettings::operator= | ( | const QgsTextBackgroundSettings & | other | ) |
Definition at line 419 of file qgstextrenderer.cpp.
QgsPaintEffect * QgsTextBackgroundSettings::paintEffect | ( | ) | const |
Returns the current paint effect for the background shape.
Definition at line 670 of file qgstextrenderer.cpp.
QSizeF QgsTextBackgroundSettings::radii | ( | ) | const |
Returns the radii used for rounding the corners of shapes.
Units are retrieved through radiiUnit().
Definition at line 560 of file qgstextrenderer.cpp.
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.
Definition at line 580 of file qgstextrenderer.cpp.
QgsUnitTypes::RenderUnit QgsTextBackgroundSettings::radiiUnit | ( | ) | const |
Returns the units used for the shape's radii.
Definition at line 570 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::readFromLayer | ( | QgsVectorLayer * | layer | ) |
Reads settings from a layer's custom properties (for QGIS 2.x projects).
layer | source vector layer |
Definition at line 680 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::readXml | ( | const QDomElement & | elem, |
const QgsReadWriteContext & | context | ||
) |
Read settings from a DOM element.
Definition at line 808 of file qgstextrenderer.cpp.
double QgsTextBackgroundSettings::rotation | ( | ) | const |
Returns the rotation for the background shape, in degrees clockwise.
Definition at line 520 of file qgstextrenderer.cpp.
QgsTextBackgroundSettings::RotationType QgsTextBackgroundSettings::rotationType | ( | ) | const |
Returns the method used for rotating the background shape.
Definition at line 510 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setBlendMode | ( | QPainter::CompositionMode | mode | ) |
Sets the blending mode used for drawing the background shape.
mode | blending mode |
Definition at line 605 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setEnabled | ( | bool | enabled | ) |
Sets whether the text background will be drawn.
enabled | set to true to draw background |
Definition at line 435 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setFillColor | ( | const QColor & | color | ) |
Sets the color used for filing the background shape.
color | background color |
Definition at line 615 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setJoinStyle | ( | Qt::PenJoinStyle | style | ) |
Sets the join style used for drawing the background shape.
style | join style |
Definition at line 665 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setMarkerSymbol | ( | QgsMarkerSymbol * | symbol | ) |
Sets the current marker symbol for the background shape.
Ownership is transferred to the background settings.
Definition at line 465 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setOffset | ( | QPointF | offset | ) |
Sets the offset used for drawing the background shape.
Units are specified using setOffsetUnit().
offset | offset for shape |
Definition at line 535 of file qgstextrenderer.cpp.
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.
scale | scale for shape offset |
Definition at line 555 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setOffsetUnit | ( | QgsUnitTypes::RenderUnit | units | ) |
Sets the units used for the shape's offset.
units | offset units |
Definition at line 545 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setOpacity | ( | double | opacity | ) |
Sets the background shape's opacity.
opacity | opacity as a double value between 0 (fully transparent) and 1 (totally opaque) |
Definition at line 595 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setPaintEffect | ( | QgsPaintEffect * | effect | ) |
Sets the current paint effect for the background shape.
effect | paint effect. Ownership is transferred to the background settings. |
Definition at line 675 of file qgstextrenderer.cpp.
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.
radii | QSizeF representing horizontal and vertical radii for rounded corners. Units are specified through setRadiiUnit() |
Definition at line 565 of file qgstextrenderer.cpp.
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.
scale | scale for shape radii |
Definition at line 585 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setRadiiUnit | ( | QgsUnitTypes::RenderUnit | units | ) |
Sets the units used for the shape's radii.
units | radii units |
Definition at line 575 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setRotation | ( | double | rotation | ) |
Sets the rotation for the background shape, in degrees clockwise.
Definition at line 525 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setRotationType | ( | QgsTextBackgroundSettings::RotationType | type | ) |
Sets the method used for rotating the background shape.
type | rotation method |
Definition at line 515 of file qgstextrenderer.cpp.
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.
size | QSizeF representing horizontal and vertical size components for shape |
Definition at line 485 of file qgstextrenderer.cpp.
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.
scale | scale for shape size |
Definition at line 505 of file qgstextrenderer.cpp.
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).
type | size method |
Definition at line 475 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setSizeUnit | ( | QgsUnitTypes::RenderUnit | unit | ) |
Sets the units used for the shape's size.
This value has no meaning if the sizeType() is set to QgsTextBackgroundSettings::SizePercent.
unit | size units |
Definition at line 495 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setStrokeColor | ( | const QColor & | color | ) |
Sets the color used for outlining the background shape.
color | stroke color |
Definition at line 625 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setStrokeWidth | ( | double | width | ) |
Sets the width of the shape's stroke (stroke).
Units are specified through setStrokeWidthUnit().
Definition at line 635 of file qgstextrenderer.cpp.
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.
scale | scale for shape stroke width |
Definition at line 655 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setStrokeWidthUnit | ( | QgsUnitTypes::RenderUnit | units | ) |
Sets the units used for the shape's stroke width.
units | stroke width units |
Definition at line 645 of file qgstextrenderer.cpp.
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.
file | Absolute SVG file path |
Definition at line 455 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::setType | ( | QgsTextBackgroundSettings::ShapeType | type | ) |
Sets the type of background shape to draw (e.g., square, ellipse, SVG).
type | shape type |
Definition at line 445 of file qgstextrenderer.cpp.
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.
Definition at line 480 of file qgstextrenderer.cpp.
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.
Definition at line 500 of file qgstextrenderer.cpp.
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).
Definition at line 470 of file qgstextrenderer.cpp.
QgsUnitTypes::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.
Definition at line 490 of file qgstextrenderer.cpp.
QColor QgsTextBackgroundSettings::strokeColor | ( | ) | const |
Returns the color used for outlining the background shape.
Definition at line 620 of file qgstextrenderer.cpp.
double QgsTextBackgroundSettings::strokeWidth | ( | ) | const |
Returns the width of the shape's stroke (stroke).
Units are retrieved through strokeWidthUnit().
Definition at line 630 of file qgstextrenderer.cpp.
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.
Definition at line 650 of file qgstextrenderer.cpp.
QgsUnitTypes::RenderUnit QgsTextBackgroundSettings::strokeWidthUnit | ( | ) | const |
Returns the units used for the shape's stroke width.
Definition at line 640 of file qgstextrenderer.cpp.
QString QgsTextBackgroundSettings::svgFile | ( | ) | const |
Returns the absolute path to the background SVG file, if set.
Definition at line 450 of file qgstextrenderer.cpp.
QgsTextBackgroundSettings::ShapeType QgsTextBackgroundSettings::type | ( | ) | const |
Returns the type of background shape (e.g., square, ellipse, SVG).
Definition at line 440 of file qgstextrenderer.cpp.
void QgsTextBackgroundSettings::updateDataDefinedProperties | ( | QgsRenderContext & | context, |
const QgsPropertyCollection & | properties | ||
) |
Updates the format by evaluating current values of data defined properties.
Definition at line 977 of file qgstextrenderer.cpp.
QDomElement QgsTextBackgroundSettings::writeXml | ( | QDomDocument & | doc, |
const QgsReadWriteContext & | context | ||
) | const |
Write settings into a DOM element.
Definition at line 939 of file qgstextrenderer.cpp.