QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
22 const QString skind =
string.trimmed();
24 if ( skind.compare( QLatin1String(
"Square" ), Qt::CaseInsensitive ) == 0 )
28 else if ( skind.compare( QLatin1String(
"Ellipse" ), Qt::CaseInsensitive ) == 0 )
32 else if ( skind.compare( QLatin1String(
"Circle" ), Qt::CaseInsensitive ) == 0 )
36 else if ( skind.compare( QLatin1String(
"SVG" ), Qt::CaseInsensitive ) == 0 )
40 else if ( skind.compare( QLatin1String(
"marker" ), Qt::CaseInsensitive ) == 0 )
49 const QString stype =
string.trimmed();
53 if ( stype.compare( QLatin1String(
"Fixed" ), Qt::CaseInsensitive ) == 0 )
62 const QString rotstr =
string.trimmed();
66 if ( rotstr.compare( QLatin1String(
"Offset" ), Qt::CaseInsensitive ) == 0 )
70 else if ( rotstr.compare( QLatin1String(
"Fixed" ), Qt::CaseInsensitive ) == 0 )
79 const QString str =
string.trimmed();
83 if ( str.compare( QLatin1String(
"Text" ), Qt::CaseInsensitive ) == 0 )
87 else if ( str.compare( QLatin1String(
"Buffer" ), Qt::CaseInsensitive ) == 0 )
91 else if ( str.compare( QLatin1String(
"Background" ), Qt::CaseInsensitive ) == 0 )
100 switch ( orientation )
103 return QStringLiteral(
"horizontal" );
105 return QStringLiteral(
"vertical" );
107 return QStringLiteral(
"rotation-based" );
117 QString cleaned = name.toLower().trimmed();
119 if ( cleaned == QLatin1String(
"horizontal" ) )
121 else if ( cleaned == QLatin1String(
"vertical" ) )
123 else if ( cleaned == QLatin1String(
"rotation-based" ) )
147 int r = layer->
customProperty( property +
'R', QVariant( defaultColor.red() ) ).toInt();
148 int g = layer->
customProperty( property +
'G', QVariant( defaultColor.green() ) ).toInt();
149 int b = layer->
customProperty( property +
'B', QVariant( defaultColor.blue() ) ).toInt();
150 int a = withAlpha ? layer->
customProperty( property +
'A', QVariant( defaultColor.alpha() ) ).toInt() : 255;
151 return QColor( r, g, b, a );
static QgsTextBackgroundSettings::SizeType decodeBackgroundSizeType(const QString &string)
Decodes a string representation of a background size type to a type.
RenderUnit
Rendering size units.
@ ShadowBuffer
Draw shadow under buffer.
static QgsTextBackgroundSettings::RotationType decodeBackgroundRotationType(const QString &string)
Decodes a string representation of a background rotation type to a type.
@ RenderPoints
Points (e.g., for font sizes)
@ RenderPercentage
Percentage of another measurement (e.g., canvas size, feature size)
SizeType
Methods for determining the background shape size.
@ RenderMillimeters
Millimeters.
@ RotationSync
Shape rotation is synced with text rotation.
static QgsTextFormat::TextOrientation decodeTextOrientation(const QString &name, bool *ok=nullptr)
Attempts to decode a string representation of a text orientation.
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.
static QString encodeTextOrientation(QgsTextFormat::TextOrientation orientation)
Encodes a text orientation.
@ RotationOffset
Shape rotation is offset from text rotation.
@ ShapeSquare
Square - buffered sizes only.
@ VerticalOrientation
Horizontally oriented text.
RotationType
Methods for determining the rotation of the background shape.
ShadowPlacement
Placement positions for text shadow.
@ ShapeRectangle
Rectangle.
static QgsTextShadowSettings::ShadowPlacement decodeShadowPlacementType(const QString &string)
Decodes a string representation of a shadow placement type to a type.
static QgsTextBackgroundSettings::ShapeType decodeShapeType(const QString &string)
Decodes a string representation of a background shape type to a type.
@ ShadowLowest
Draw shadow below all text components.
@ SizeBuffer
Shape size is determined by adding a buffer margin around text.
@ ShadowShape
Draw shadow under background shape.
Q_INVOKABLE QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
@ RotationBasedOrientation
Horizontally or vertically oriented text based on rotation (only available for map labeling)
Represents a vector layer which manages a vector based data sets.
@ ShadowText
Draw shadow under text.
ShapeType
Background shape types.
@ ShapeMarkerSymbol
Marker symbol.
@ RotationFixed
Shape rotation is a fixed angle.
static QgsUnitTypes::RenderUnit convertFromOldLabelUnit(int val)
Converts a unit from an old (pre 3.0) label unit.
@ HorizontalOrientation
Vertically oriented text.
@ RenderMapUnits
Map units.
TextOrientation
Text orientation.