QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
24 d =
new QgsTextMaskSettingsPrivate();
83 return d->sizeMapUnitScale;
88 d->sizeMapUnitScale = scale;
113 return d->paintEffect.get();
118 d->paintEffect.reset( effect );
138 if ( exprVal.isValid() )
140 QString units = exprVal.toString();
141 if ( !units.isEmpty() )
160 QString joinstr = exprVal.toString().trimmed();
161 if ( !joinstr.isEmpty() )
170 return QSet< QString >();
175 QDomElement textMaskElem = elem.firstChildElement( QStringLiteral(
"text-mask" ) );
176 d->enabled = textMaskElem.attribute( QStringLiteral(
"maskEnabled" ), QStringLiteral(
"0" ) ).toInt();
177 d->type =
static_cast<QgsTextMaskSettings::MaskType>( textMaskElem.attribute( QStringLiteral(
"maskType" ), QStringLiteral(
"0" ) ).toInt() );
178 d->size = textMaskElem.attribute( QStringLiteral(
"maskSize" ), QStringLiteral(
"0" ) ).toDouble();
181 d->joinStyle =
static_cast< Qt::PenJoinStyle
>( textMaskElem.attribute( QStringLiteral(
"maskJoinStyle" ), QString::number( Qt::RoundJoin ) ).toUInt() );
182 d->opacity = textMaskElem.attribute( QStringLiteral(
"maskOpacity" ), QStringLiteral(
"1.0" ) ).toDouble();
183 QDomElement effectElem = textMaskElem.firstChildElement( QStringLiteral(
"effect" ) );
184 if ( !effectElem.isNull() )
193 QDomElement textMaskElem = doc.createElement( QStringLiteral(
"text-mask" ) );
194 textMaskElem.setAttribute( QStringLiteral(
"maskEnabled" ), d->enabled );
195 textMaskElem.setAttribute( QStringLiteral(
"maskType" ), d->type );
196 textMaskElem.setAttribute( QStringLiteral(
"maskSize" ), d->size );
199 textMaskElem.setAttribute( QStringLiteral(
"maskJoinStyle" ),
static_cast< unsigned int >( d->joinStyle ) );
200 textMaskElem.setAttribute( QStringLiteral(
"maskOpacity" ), d->opacity );
202 d->paintEffect->saveProperties( doc, textMaskElem );
209 return d->maskedSymbolLayers;
214 d->maskedSymbolLayers = maskedSymbols;
void setSize(double size)
Sets the size of the buffer.
bool enabled() const
Returns whether the mask is enabled.
@ MaskEnabled
Whether the mask is enabled.
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.
@ MaskBufferSize
Mask buffer size.
RenderUnit
Rendering size units.
QgsExpressionContext & expressionContext()
Gets the expression context.
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
void setType(MaskType type)
Sets the type of mask shape.
QgsPaintEffect * createEffect(const QString &name, const QgsStringMap &properties=QgsStringMap()) const
Creates a new paint effect given the effect name and properties map.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
MaskType
Mask shape types.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the buffer size.
double size() const
Returns the size of the buffer.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the mask.
static Q_INVOKABLE QgsUnitTypes::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
void updateDataDefinedProperties(QgsRenderContext &context, const QgsPropertyCollection &properties)
Updates the format by evaluating current values of data defined properties.
QgsTextMaskSettings & operator=(const QgsTextMaskSettings &other)
Copy constructor.
void readXml(const QDomElement &elem)
Read settings from a DOM element.
static bool isDefaultStack(QgsPaintEffect *effect)
Tests whether a paint effect matches the default effects stack.
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style used for drawing the buffer.
@ MaskOpacity
Mask opacity.
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the buffer size.
@ MaskBufferUnit
Mask buffer size unit.
double opacity() const
Returns the mask's opacity.
QgsSymbolLayerReferenceList stringToSymbolLayerReferenceList(const QString &str)
Utilitary function to parse a string originated from symbolLayerReferenceListToString into a QgsSymbo...
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the buffer size.
Struct for storing maximum and minimum scales for measurements in map units.
@ MaskJoinStyle
Mask join style.
QgsSymbolLayerReferenceList maskedSymbolLayers() const
Returns a list of references to symbol layers that are masked by this buffer.
QString symbolLayerReferenceListToString(const QgsSymbolLayerReferenceList &lst)
Utilitary function to turn a QgsSymbolLayerReferenceList into a string.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
static QgsPaintEffectRegistry * paintEffectRegistry()
Returns the application's paint effect registry, used for managing paint effects.
void setMaskedSymbolLayers(QgsSymbolLayerReferenceList maskedLayers)
Sets the symbol layers that will be masked by this buffer.
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.
QList< QgsSymbolLayerReference > QgsSymbolLayerReferenceList
void setEnabled(bool)
Returns whether the mask is enabled.
Base class for visual effects which can be applied to QPicture drawings.
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the mask.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the buffer size.
void setOpacity(double opacity)
Sets the mask's opacity.
static Qt::PenJoinStyle decodePenJoinStyle(const QString &str)
QSet< QString > referencedFields(const QgsRenderContext &context) const
Returns all field names referenced by the configuration (e.g.
QDomElement writeXml(QDomDocument &doc) const
Write settings into a DOM element.
MaskType type() const
Returns the type of mask shape.
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
Qt::PenJoinStyle joinStyle() const
Returns the buffer join style.