QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgstextbuffersettings.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgstextbuffersettings.cpp
3  -----------------
4  begin : May 2020
5  copyright : (C) Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7 
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #include "qgstextbuffersettings.h"
18 #include "qgstextrenderer_p.h"
19 #include "qgsvectorlayer.h"
20 #include "qgspallabeling.h"
21 #include "qgssymbollayerutils.h"
22 #include "qgspainting.h"
23 #include "qgspainteffectregistry.h"
24 #include "qgstextrendererutils.h"
25 
27 {
28  d = new QgsTextBufferSettingsPrivate();
29 }
30 
32  : d( other.d )
33 {
34 }
35 
37 {
38  d = other.d;
39  return *this;
40 }
41 
43 {
44 
45 }
46 
48 {
49  return d->enabled;
50 }
51 
53 {
54  d->enabled = enabled;
55 }
56 
58 {
59  return d->size;
60 }
61 
62 void QgsTextBufferSettings::setSize( double size )
63 {
64  d->size = size;
65 }
66 
68 {
69  return d->sizeUnit;
70 }
71 
73 {
74  d->sizeUnit = unit;
75 }
76 
78 {
79  return d->sizeMapUnitScale;
80 }
81 
83 {
84  d->sizeMapUnitScale = scale;
85 }
86 
88 {
89  return d->color;
90 }
91 
92 void QgsTextBufferSettings::setColor( const QColor &color )
93 {
94  d->color = color;
95 }
96 
98 {
99  return d->fillBufferInterior;
100 }
101 
103 {
104  d->fillBufferInterior = fill;
105 }
106 
108 {
109  return d->opacity;
110 }
111 
112 void QgsTextBufferSettings::setOpacity( double opacity )
113 {
114  d->opacity = opacity;
115 }
116 
117 Qt::PenJoinStyle QgsTextBufferSettings::joinStyle() const
118 {
119  return d->joinStyle;
120 }
121 
122 void QgsTextBufferSettings::setJoinStyle( Qt::PenJoinStyle style )
123 {
124  d->joinStyle = style;
125 }
126 
127 QPainter::CompositionMode QgsTextBufferSettings::blendMode() const
128 {
129  return d->blendMode;
130 }
131 
132 void QgsTextBufferSettings::setBlendMode( QPainter::CompositionMode mode )
133 {
134  d->blendMode = mode;
135 }
136 
138 {
139  return d->paintEffect.get();
140 }
141 
143 {
144  d->paintEffect.reset( effect );
145 }
146 
148 {
149  if ( properties.isActive( QgsPalLayerSettings::BufferDraw ) )
150  {
151  context.expressionContext().setOriginalValueVariable( d->enabled );
152  d->enabled = properties.valueAsBool( QgsPalLayerSettings::BufferDraw, context.expressionContext(), d->enabled );
153  }
154 
155  if ( properties.isActive( QgsPalLayerSettings::BufferSize ) )
156  {
157  context.expressionContext().setOriginalValueVariable( d->size );
158  d->size = properties.valueAsDouble( QgsPalLayerSettings::BufferSize, context.expressionContext(), d->size );
159  }
160 
161  QVariant exprVal = properties.value( QgsPalLayerSettings::BufferUnit, context.expressionContext() );
162  if ( exprVal.isValid() )
163  {
164  QString units = exprVal.toString();
165  if ( !units.isEmpty() )
166  {
167  bool ok;
169  if ( ok )
170  d->sizeUnit = res;
171  }
172  }
173 
174  if ( properties.isActive( QgsPalLayerSettings::BufferOpacity ) )
175  {
176  context.expressionContext().setOriginalValueVariable( d->opacity * 100 );
177  d->opacity = properties.value( QgsPalLayerSettings::BufferOpacity, context.expressionContext(), d->opacity * 100 ).toDouble() / 100.0;
178  }
179 
180  if ( properties.isActive( QgsPalLayerSettings::BufferColor ) )
181  {
183  d->color = properties.valueAsColor( QgsPalLayerSettings::BufferColor, context.expressionContext(), d->color );
184  }
185 
187  {
188  exprVal = properties.value( QgsPalLayerSettings::BufferBlendMode, context.expressionContext() );
189  QString blendstr = exprVal.toString().trimmed();
190  if ( !blendstr.isEmpty() )
191  d->blendMode = QgsSymbolLayerUtils::decodeBlendMode( blendstr );
192  }
193 
195  {
196  exprVal = properties.value( QgsPalLayerSettings::BufferJoinStyle, context.expressionContext() );
197  QString joinstr = exprVal.toString().trimmed();
198  if ( !joinstr.isEmpty() )
199  {
200  d->joinStyle = QgsSymbolLayerUtils::decodePenJoinStyle( joinstr );
201  }
202  }
203 }
204 
206 {
207  return QSet< QString >(); // nothing for now
208 }
209 
211 {
212  // text buffer
213  double bufSize = layer->customProperty( QStringLiteral( "labeling/bufferSize" ), QVariant( 0.0 ) ).toDouble();
214 
215  // fix for buffer being keyed off of just its size in the past (<2.0)
216  QVariant drawBuffer = layer->customProperty( QStringLiteral( "labeling/bufferDraw" ), QVariant() );
217  if ( drawBuffer.isValid() )
218  {
219  d->enabled = drawBuffer.toBool();
220  d->size = bufSize;
221  }
222  else if ( bufSize != 0.0 )
223  {
224  d->enabled = true;
225  d->size = bufSize;
226  }
227  else
228  {
229  // keep bufferSize at new 1.0 default
230  d->enabled = false;
231  }
232 
233  if ( layer->customProperty( QStringLiteral( "labeling/bufferSizeUnits" ) ).toString().isEmpty() )
234  {
235  bool bufferSizeInMapUnits = layer->customProperty( QStringLiteral( "labeling/bufferSizeInMapUnits" ) ).toBool();
236  d->sizeUnit = bufferSizeInMapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters;
237  }
238  else
239  {
240  d->sizeUnit = QgsUnitTypes::decodeRenderUnit( layer->customProperty( QStringLiteral( "labeling/bufferSizeUnits" ) ).toString() );
241  }
242 
243  if ( layer->customProperty( QStringLiteral( "labeling/bufferSizeMapUnitScale" ) ).toString().isEmpty() )
244  {
245  //fallback to older property
246  double oldMin = layer->customProperty( QStringLiteral( "labeling/bufferSizeMapUnitMinScale" ), 0.0 ).toDouble();
247  d->sizeMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
248  double oldMax = layer->customProperty( QStringLiteral( "labeling/bufferSizeMapUnitMaxScale" ), 0.0 ).toDouble();
249  d->sizeMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
250  }
251  else
252  {
253  d->sizeMapUnitScale = QgsSymbolLayerUtils::decodeMapUnitScale( layer->customProperty( QStringLiteral( "labeling/bufferSizeMapUnitScale" ) ).toString() );
254  }
255  d->color = QgsTextRendererUtils::readColor( layer, QStringLiteral( "labeling/bufferColor" ), Qt::white, false );
256  if ( layer->customProperty( QStringLiteral( "labeling/bufferOpacity" ) ).toString().isEmpty() )
257  {
258  d->opacity = ( 1 - layer->customProperty( QStringLiteral( "labeling/bufferTransp" ) ).toInt() / 100.0 ); //0 -100
259  }
260  else
261  {
262  d->opacity = ( layer->customProperty( QStringLiteral( "labeling/bufferOpacity" ) ).toDouble() );
263  }
264  d->blendMode = QgsPainting::getCompositionMode(
265  static_cast< QgsPainting::BlendMode >( layer->customProperty( QStringLiteral( "labeling/bufferBlendMode" ), QVariant( QgsPainting::BlendNormal ) ).toUInt() ) );
266  d->joinStyle = static_cast< Qt::PenJoinStyle >( layer->customProperty( QStringLiteral( "labeling/bufferJoinStyle" ), QVariant( Qt::RoundJoin ) ).toUInt() );
267 
268  d->fillBufferInterior = !layer->customProperty( QStringLiteral( "labeling/bufferNoFill" ), QVariant( false ) ).toBool();
269 
270  if ( layer->customProperty( QStringLiteral( "labeling/bufferEffect" ) ).isValid() )
271  {
272  QDomDocument doc( QStringLiteral( "effect" ) );
273  doc.setContent( layer->customProperty( QStringLiteral( "labeling/bufferEffect" ) ).toString() );
274  QDomElement effectElem = doc.firstChildElement( QStringLiteral( "effect" ) ).firstChildElement( QStringLiteral( "effect" ) );
275  setPaintEffect( QgsApplication::paintEffectRegistry()->createEffect( effectElem ) );
276  }
277  else
278  setPaintEffect( nullptr );
279 }
280 
281 void QgsTextBufferSettings::readXml( const QDomElement &elem )
282 {
283  QDomElement textBufferElem = elem.firstChildElement( QStringLiteral( "text-buffer" ) );
284  double bufSize = textBufferElem.attribute( QStringLiteral( "bufferSize" ), QStringLiteral( "0" ) ).toDouble();
285 
286  // fix for buffer being keyed off of just its size in the past (<2.0)
287  QVariant drawBuffer = textBufferElem.attribute( QStringLiteral( "bufferDraw" ) );
288  if ( drawBuffer.isValid() )
289  {
290  d->enabled = drawBuffer.toBool();
291  d->size = bufSize;
292  }
293  else if ( bufSize != 0.0 )
294  {
295  d->enabled = true;
296  d->size = bufSize;
297  }
298  else
299  {
300  // keep bufferSize at new 1.0 default
301  d->enabled = false;
302  }
303 
304  if ( !textBufferElem.hasAttribute( QStringLiteral( "bufferSizeUnits" ) ) )
305  {
306  bool bufferSizeInMapUnits = textBufferElem.attribute( QStringLiteral( "bufferSizeInMapUnits" ) ).toInt();
307  d->sizeUnit = bufferSizeInMapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters;
308  }
309  else
310  {
311  d->sizeUnit = QgsUnitTypes::decodeRenderUnit( textBufferElem.attribute( QStringLiteral( "bufferSizeUnits" ) ) );
312  }
313 
314  if ( !textBufferElem.hasAttribute( QStringLiteral( "bufferSizeMapUnitScale" ) ) )
315  {
316  //fallback to older property
317  double oldMin = textBufferElem.attribute( QStringLiteral( "bufferSizeMapUnitMinScale" ), QStringLiteral( "0" ) ).toDouble();
318  d->sizeMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
319  double oldMax = textBufferElem.attribute( QStringLiteral( "bufferSizeMapUnitMaxScale" ), QStringLiteral( "0" ) ).toDouble();
320  d->sizeMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
321  }
322  else
323  {
324  d->sizeMapUnitScale = QgsSymbolLayerUtils::decodeMapUnitScale( textBufferElem.attribute( QStringLiteral( "bufferSizeMapUnitScale" ) ) );
325  }
326  d->color = QgsSymbolLayerUtils::decodeColor( textBufferElem.attribute( QStringLiteral( "bufferColor" ), QgsSymbolLayerUtils::encodeColor( Qt::white ) ) );
327 
328  if ( !textBufferElem.hasAttribute( QStringLiteral( "bufferOpacity" ) ) )
329  {
330  d->opacity = ( 1 - textBufferElem.attribute( QStringLiteral( "bufferTransp" ) ).toInt() / 100.0 ); //0 -100
331  }
332  else
333  {
334  d->opacity = ( textBufferElem.attribute( QStringLiteral( "bufferOpacity" ) ).toDouble() );
335  }
336 
337  d->blendMode = QgsPainting::getCompositionMode(
338  static_cast< QgsPainting::BlendMode >( textBufferElem.attribute( QStringLiteral( "bufferBlendMode" ), QString::number( QgsPainting::BlendNormal ) ).toUInt() ) );
339  d->joinStyle = static_cast< Qt::PenJoinStyle >( textBufferElem.attribute( QStringLiteral( "bufferJoinStyle" ), QString::number( Qt::RoundJoin ) ).toUInt() );
340  d->fillBufferInterior = !textBufferElem.attribute( QStringLiteral( "bufferNoFill" ), QStringLiteral( "0" ) ).toInt();
341  QDomElement effectElem = textBufferElem.firstChildElement( QStringLiteral( "effect" ) );
342  if ( !effectElem.isNull() )
344  else
345  setPaintEffect( nullptr );
346 }
347 
348 QDomElement QgsTextBufferSettings::writeXml( QDomDocument &doc ) const
349 {
350  // text buffer
351  QDomElement textBufferElem = doc.createElement( QStringLiteral( "text-buffer" ) );
352  textBufferElem.setAttribute( QStringLiteral( "bufferDraw" ), d->enabled );
353  textBufferElem.setAttribute( QStringLiteral( "bufferSize" ), d->size );
354  textBufferElem.setAttribute( QStringLiteral( "bufferSizeUnits" ), QgsUnitTypes::encodeUnit( d->sizeUnit ) );
355  textBufferElem.setAttribute( QStringLiteral( "bufferSizeMapUnitScale" ), QgsSymbolLayerUtils::encodeMapUnitScale( d->sizeMapUnitScale ) );
356  textBufferElem.setAttribute( QStringLiteral( "bufferColor" ), QgsSymbolLayerUtils::encodeColor( d->color ) );
357  textBufferElem.setAttribute( QStringLiteral( "bufferNoFill" ), !d->fillBufferInterior );
358  textBufferElem.setAttribute( QStringLiteral( "bufferOpacity" ), d->opacity );
359  textBufferElem.setAttribute( QStringLiteral( "bufferJoinStyle" ), static_cast< unsigned int >( d->joinStyle ) );
360  textBufferElem.setAttribute( QStringLiteral( "bufferBlendMode" ), QgsPainting::getBlendModeEnum( d->blendMode ) );
361  if ( d->paintEffect && !QgsPaintEffectRegistry::isDefaultStack( d->paintEffect.get() ) )
362  d->paintEffect->saveProperties( doc, textBufferElem );
363  return textBufferElem;
364 }
QgsPalLayerSettings::BufferBlendMode
@ BufferBlendMode
Definition: qgspallabeling.h:379
QgsTextBufferSettings::setSizeUnit
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the buffer size.
Definition: qgstextbuffersettings.cpp:72
QgsPainting::BlendNormal
@ BlendNormal
Definition: qgspainting.h:64
QgsAbstractPropertyCollection::valueAsDouble
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.
Definition: qgspropertycollection.cpp:66
QgsSymbolLayerUtils::encodeColor
static QString encodeColor(const QColor &color)
Definition: qgssymbollayerutils.cpp:52
qgspallabeling.h
QgsSymbolLayerUtils::decodeBlendMode
static QPainter::CompositionMode decodeBlendMode(const QString &s)
Definition: qgssymbollayerutils.cpp:745
QgsTextBufferSettings::setOpacity
void setOpacity(double opacity)
Sets the buffer opacity.
Definition: qgstextbuffersettings.cpp:112
QgsTextBufferSettings::sizeMapUnitScale
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the buffer size.
Definition: qgstextbuffersettings.cpp:77
QgsUnitTypes::RenderUnit
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:166
QgsRenderContext::expressionContext
QgsExpressionContext & expressionContext()
Gets the expression context.
Definition: qgsrendercontext.h:580
QgsPainting::BlendMode
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer.
Definition: qgspainting.h:49
QgsPalLayerSettings::BufferSize
@ BufferSize
Definition: qgspallabeling.h:373
QgsSymbolLayerUtils::encodeMapUnitScale
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
Definition: qgssymbollayerutils.cpp:558
QgsTextBufferSettings::joinStyle
Qt::PenJoinStyle joinStyle() const
Returns the buffer join style.
Definition: qgstextbuffersettings.cpp:117
QgsTextBufferSettings::~QgsTextBufferSettings
~QgsTextBufferSettings()
Definition: qgstextbuffersettings.cpp:42
qgstextrenderer_p.h
QgsTextBufferSettings::setEnabled
void setEnabled(bool enabled)
Sets whether the text buffer will be drawn.
Definition: qgstextbuffersettings.cpp:52
QgsPaintEffectRegistry::createEffect
QgsPaintEffect * createEffect(const QString &name, const QgsStringMap &properties=QgsStringMap()) const
Creates a new paint effect given the effect name and properties map.
Definition: qgspainteffectregistry.cpp:77
QgsPalLayerSettings::BufferUnit
@ BufferUnit
Definition: qgspallabeling.h:374
QgsExpressionContext::setOriginalValueVariable
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
Definition: qgsexpressioncontext.cpp:566
qgssymbollayerutils.h
QgsTextBufferSettings::updateDataDefinedProperties
void updateDataDefinedProperties(QgsRenderContext &context, const QgsPropertyCollection &properties)
Updates the format by evaluating current values of data defined properties.
Definition: qgstextbuffersettings.cpp:147
QgsPalLayerSettings::BufferOpacity
@ BufferOpacity
Buffer opacity.
Definition: qgspallabeling.h:377
QgsPalLayerSettings::BufferJoinStyle
@ BufferJoinStyle
Definition: qgspallabeling.h:378
QgsTextBufferSettings::opacity
double opacity() const
Returns the buffer opacity.
Definition: qgstextbuffersettings.cpp:107
QgsRenderContext
Definition: qgsrendercontext.h:57
QgsUnitTypes::RenderMillimeters
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:168
QgsTextRendererUtils::readColor
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.
Definition: qgstextrendererutils.cpp:145
qgspainteffectregistry.h
QgsTextBufferSettings::setFillBufferInterior
void setFillBufferInterior(bool fill)
Sets whether the interior of the buffer will be filled in.
Definition: qgstextbuffersettings.cpp:102
QgsSymbolLayerUtils::decodeColor
static QColor decodeColor(const QString &str)
Definition: qgssymbollayerutils.cpp:57
QgsTextBufferSettings::setSizeMapUnitScale
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the buffer size.
Definition: qgstextbuffersettings.cpp:82
QgsTextBufferSettings::operator=
QgsTextBufferSettings & operator=(const QgsTextBufferSettings &other)
Copy constructor.
Definition: qgstextbuffersettings.cpp:36
QgsUnitTypes::decodeRenderUnit
static Q_INVOKABLE QgsUnitTypes::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
Definition: qgsunittypes.cpp:2900
QgsPainting::getBlendModeEnum
static QgsPainting::BlendMode getBlendModeEnum(QPainter::CompositionMode blendMode)
Returns a BlendMode corresponding to a QPainter::CompositionMode.
Definition: qgspainting.cpp:80
qgstextbuffersettings.h
QgsPaintEffectRegistry::isDefaultStack
static bool isDefaultStack(QgsPaintEffect *effect)
Tests whether a paint effect matches the default effects stack.
Definition: qgspainteffectregistry.cpp:134
qgstextrendererutils.h
QgsUnitTypes::encodeUnit
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
Definition: qgsunittypes.cpp:122
QgsTextBufferSettings::writeXml
QDomElement writeXml(QDomDocument &doc) const
Write settings into a DOM element.
Definition: qgstextbuffersettings.cpp:348
QgsPalLayerSettings::BufferColor
@ BufferColor
Definition: qgspallabeling.h:375
QgsTextBufferSettings::referencedFields
QSet< QString > referencedFields(const QgsRenderContext &context) const
Returns all field names referenced by the configuration (e.g.
Definition: qgstextbuffersettings.cpp:205
QgsTextBufferSettings::setPaintEffect
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the buffer.
Definition: qgstextbuffersettings.cpp:142
QgsPainting::getCompositionMode
static QPainter::CompositionMode getCompositionMode(QgsPainting::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode.
Definition: qgspainting.cpp:20
qgspainting.h
QgsMapUnitScale
Struct for storing maximum and minimum scales for measurements in map units.
Definition: qgsmapunitscale.h:37
QgsTextBufferSettings
Definition: qgstextbuffersettings.h:42
QgsPalLayerSettings::BufferDraw
@ BufferDraw
Definition: qgspallabeling.h:372
QgsTextBufferSettings::sizeUnit
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the buffer size.
Definition: qgstextbuffersettings.cpp:67
QgsTextBufferSettings::readXml
void readXml(const QDomElement &elem)
Read settings from a DOM element.
Definition: qgstextbuffersettings.cpp:281
QgsTextBufferSettings::size
double size() const
Returns the size of the buffer.
Definition: qgstextbuffersettings.cpp:57
qgsvectorlayer.h
QgsPropertyCollection
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
Definition: qgspropertycollection.h:318
QgsTextBufferSettings::enabled
bool enabled() const
Returns whether the buffer is enabled.
Definition: qgstextbuffersettings.cpp:47
QgsMapLayer::customProperty
Q_INVOKABLE QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
Definition: qgsmaplayer.cpp:1718
QgsApplication::paintEffectRegistry
static QgsPaintEffectRegistry * paintEffectRegistry()
Returns the application's paint effect registry, used for managing paint effects.
Definition: qgsapplication.cpp:2094
QgsPropertyCollection::value
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.
Definition: qgspropertycollection.cpp:218
QgsAbstractPropertyCollection::valueAsBool
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.
Definition: qgspropertycollection.cpp:88
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsTextBufferSettings::paintEffect
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the buffer.
Definition: qgstextbuffersettings.cpp:137
QgsTextBufferSettings::setBlendMode
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the buffer.
Definition: qgstextbuffersettings.cpp:132
QgsPaintEffect
Base class for visual effects which can be applied to QPicture drawings.
Definition: qgspainteffect.h:53
QgsTextBufferSettings::setSize
void setSize(double size)
Sets the size of the buffer.
Definition: qgstextbuffersettings.cpp:62
QgsTextBufferSettings::QgsTextBufferSettings
QgsTextBufferSettings()
Definition: qgstextbuffersettings.cpp:26
QgsTextBufferSettings::setColor
void setColor(const QColor &color)
Sets the color for the buffer.
Definition: qgstextbuffersettings.cpp:92
QgsSymbolLayerUtils::decodePenJoinStyle
static Qt::PenJoinStyle decodePenJoinStyle(const QString &str)
Definition: qgssymbollayerutils.cpp:188
QgsTextBufferSettings::setJoinStyle
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style used for drawing the buffer.
Definition: qgstextbuffersettings.cpp:122
QgsTextBufferSettings::readFromLayer
void readFromLayer(QgsVectorLayer *layer)
Reads settings from a layer's custom properties (for QGIS 2.x projects).
Definition: qgstextbuffersettings.cpp:210
QgsTextBufferSettings::color
QColor color() const
Returns the color of the buffer.
Definition: qgstextbuffersettings.cpp:87
QgsTextBufferSettings::fillBufferInterior
bool fillBufferInterior() const
Returns whether the interior of the buffer will be filled in.
Definition: qgstextbuffersettings.cpp:97
QgsPropertyCollection::isActive
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
Definition: qgspropertycollection.cpp:258
QgsTextBufferSettings::blendMode
QPainter::CompositionMode blendMode() const
Returns the blending mode used for drawing the buffer.
Definition: qgstextbuffersettings.cpp:127
QgsUnitTypes::RenderMapUnits
@ RenderMapUnits
Map units.
Definition: qgsunittypes.h:169
QgsSymbolLayerUtils::decodeMapUnitScale
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
Definition: qgssymbollayerutils.cpp:568
QgsAbstractPropertyCollection::valueAsColor
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.
Definition: qgspropertycollection.cpp:54