Skip to content

Commit 5cfed12

Browse files
committedJul 26, 2017
Ading all other labelling options supported by SLD. fixes #8925
1 parent 59d8b18 commit 5cfed12

File tree

11 files changed

+2295
-74
lines changed

11 files changed

+2295
-74
lines changed
 

‎python/core/qgsvectorlayerlabeling.sip

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ Try to create instance of an implementation based on the XML data
7676
:rtype: QgsAbstractVectorLayerLabeling
7777
%End
7878

79+
virtual void toSld( QDomNode &parent, const QgsStringMap &props ) const;
80+
%Docstring
81+
Writes the SE 1.1 TextSymbolizer element based on the current layer labeling settings
82+
%End
83+
7984
private:
8085
QgsAbstractVectorLayerLabeling( const QgsAbstractVectorLayerLabeling &rhs );
8186
};
@@ -105,6 +110,7 @@ Constructs simple labeling configuration with given initial settings
105110
virtual QgsPalLayerSettings settings( const QString &providerId = QString() ) const;
106111
virtual bool requiresAdvancedEffects() const;
107112

113+
virtual void toSld( QDomNode &parent, const QgsStringMap &props ) const;
108114

109115
static QgsVectorLayerSimpleLabeling *create( const QDomElement &element, const QgsReadWriteContext &context );
110116
%Docstring

‎python/core/symbology-ng/qgssymbollayerutils.sip

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,14 @@ Create ogr feature style string for pen
481481
:rtype: bool
482482
%End
483483

484+
static void createAnchorPointElement( QDomDocument &doc, QDomElement &element, QPointF anchor );
485+
%Docstring
486+
Creates a SE 1.1 anchor point element as a child of the specified element
487+
\param doc The document
488+
\param element The parent element
489+
\param anchor An anchor specification, with values between 0 and 1
490+
%End
491+
484492
static void createOnlineResourceElement( QDomDocument &doc, QDomElement &element, const QString &path, const QString &format );
485493
static bool onlineResourceFromSldElement( QDomElement &element, QString &path, QString &format );
486494
%Docstring

‎src/core/qgsvectorlayer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,7 +2211,8 @@ bool QgsVectorLayer::writeSld( QDomNode &node, QDomDocument &doc, QString &error
22112211
QgsSymbolLayerUtils::mergeScaleDependencies( maximumScale(), minimumScale(), localProps );
22122212
}
22132213

2214-
if ( isSpatial() ) {
2214+
if ( isSpatial() )
2215+
{
22152216
// store the Name element
22162217
QDomElement nameNode = doc.createElement( "se:Name" );
22172218
nameNode.appendChild( doc.createTextNode( name() ) );
@@ -2229,7 +2230,7 @@ bool QgsVectorLayer::writeSld( QDomNode &node, QDomDocument &doc, QString &error
22292230
userStyleElem.appendChild( featureTypeStyleElem );
22302231

22312232
mRenderer->toSld( doc, featureTypeStyleElem, localProps );
2232-
if ( mLabeling != nullptr )
2233+
if ( labelsEnabled() )
22332234
{
22342235
mLabeling->toSld( featureTypeStyleElem, localProps );
22352236
}

‎src/core/qgsvectorlayerlabeling.cpp

Lines changed: 415 additions & 6 deletions
Large diffs are not rendered by default.

‎src/core/qgsvectorlayerlabeling.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ class CORE_EXPORT QgsAbstractVectorLayerLabeling
7777
static QgsAbstractVectorLayerLabeling *create( const QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
7878

7979
/**
80-
* Writes the SE 1.1 TextSymbolizer element based on the current layer labelling settings
80+
* Writes the SE 1.1 TextSymbolizer element based on the current layer labeling settings
8181
*/
82-
virtual void toSld( QDomNode& parent, const QgsStringMap& props ) const
82+
virtual void toSld( QDomNode &parent, const QgsStringMap &props ) const
8383
{
8484
Q_UNUSED( parent )
8585
Q_UNUSED( props )
@@ -116,7 +116,7 @@ class CORE_EXPORT QgsVectorLayerSimpleLabeling : public QgsAbstractVectorLayerLa
116116
virtual QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) const override;
117117
virtual QgsPalLayerSettings settings( const QString &providerId = QString() ) const override;
118118
bool requiresAdvancedEffects() const override;
119-
virtual void toSld( QDomNode& parent, const QgsStringMap& props ) const override;
119+
virtual void toSld( QDomNode &parent, const QgsStringMap &props ) const override;
120120

121121
//! Create the instance from a DOM element with saved configuration
122122
static QgsVectorLayerSimpleLabeling *create( const QDomElement &element, const QgsReadWriteContext &context );

‎src/core/symbology-ng/qgssymbollayerutils.cpp

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,15 +2313,32 @@ void QgsSymbolLayerUtils::createDisplacementElement( QDomDocument &doc, QDomElem
23132313
element.appendChild( displacementElem );
23142314

23152315
QDomElement dispXElem = doc.createElement( QStringLiteral( "se:DisplacementX" ) );
2316-
dispXElem.appendChild( doc.createTextNode( qgsDoubleToString( offset.x() ) ) );
2316+
dispXElem.appendChild( doc.createTextNode( qgsDoubleToString( offset.x(), 2 ) ) );
23172317

23182318
QDomElement dispYElem = doc.createElement( QStringLiteral( "se:DisplacementY" ) );
2319-
dispYElem.appendChild( doc.createTextNode( qgsDoubleToString( offset.y() ) ) );
2319+
dispYElem.appendChild( doc.createTextNode( qgsDoubleToString( offset.y(), 2 ) ) );
23202320

23212321
displacementElem.appendChild( dispXElem );
23222322
displacementElem.appendChild( dispYElem );
23232323
}
23242324

2325+
void QgsSymbolLayerUtils::createAnchorPointElement( QDomDocument &doc, QDomElement &element, QPointF anchor )
2326+
{
2327+
// anchor is not tested for null, (0,0) is _not_ the default value (0.5, 0) is.
2328+
2329+
QDomElement anchorElem = doc.createElement( QStringLiteral( "se:AnchorPoint" ) );
2330+
element.appendChild( anchorElem );
2331+
2332+
QDomElement anchorXElem = doc.createElement( QStringLiteral( "se:AnchorPointX" ) );
2333+
anchorXElem.appendChild( doc.createTextNode( qgsDoubleToString( anchor.x() ) ) );
2334+
2335+
QDomElement anchorYElem = doc.createElement( QStringLiteral( "se:AnchorPointY" ) );
2336+
anchorYElem.appendChild( doc.createTextNode( qgsDoubleToString( anchor.y() ) ) );
2337+
2338+
anchorElem.appendChild( anchorXElem );
2339+
anchorElem.appendChild( anchorYElem );
2340+
}
2341+
23252342
bool QgsSymbolLayerUtils::displacementFromSldElement( QDomElement &element, QPointF &offset )
23262343
{
23272344
offset = QPointF( 0, 0 );
@@ -2656,7 +2673,7 @@ QgsStringMap QgsSymbolLayerUtils::getSvgParameterList( QDomElement &element )
26562673

26572674
QDomElement QgsSymbolLayerUtils::createVendorOptionElement( QDomDocument &doc, const QString &name, const QString &value )
26582675
{
2659-
QDomElement nodeElem = doc.createElement( QStringLiteral( "VendorOption" ) );
2676+
QDomElement nodeElem = doc.createElement( QStringLiteral( "se:VendorOption" ) );
26602677
nodeElem.setAttribute( QStringLiteral( "name" ), name );
26612678
nodeElem.appendChild( doc.createTextNode( value ) );
26622679
return nodeElem;
@@ -4028,8 +4045,26 @@ double QgsSymbolLayerUtils::rescaleUom( double size, QgsUnitTypes::RenderUnit un
40284045
scale = 1 / 0.28;
40294046
roundToUnit = true;
40304047
break;
4031-
// we don't have a good case for map units, as pixel values won't change based on zoom
4032-
default:
4048+
case QgsUnitTypes::RenderInches:
4049+
scale = 1 / 0.28 * 25.4;
4050+
roundToUnit = true;
4051+
break;
4052+
case QgsUnitTypes::RenderPoints:
4053+
scale = 90. /* dots per inch according to OGC SLD */ / 72. /* points per inch */;
4054+
roundToUnit = true;
4055+
break;
4056+
case QgsUnitTypes::RenderPixels:
4057+
// pixel is pixel
4058+
scale = 1;
4059+
break;
4060+
case QgsUnitTypes::RenderMapUnits:
4061+
case QgsUnitTypes::RenderMetersInMapUnits:
4062+
// already handed via uom
4063+
scale = 1;
4064+
break;
4065+
case QgsUnitTypes::RenderPercentage:
4066+
case QgsUnitTypes::RenderUnknownUnit:
4067+
// these do not make sense and should not really reach here
40334068
scale = 1;
40344069
}
40354070
}

‎src/core/symbology-ng/qgssymbollayerutils.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,14 @@ class CORE_EXPORT QgsSymbolLayerUtils
332332
static void createDisplacementElement( QDomDocument &doc, QDomElement &element, QPointF offset );
333333
static bool displacementFromSldElement( QDomElement &element, QPointF &offset );
334334

335+
/**
336+
* \brief Creates a SE 1.1 anchor point element as a child of the specified element
337+
* \param doc The document
338+
* \param element The parent element
339+
* \param anchor An anchor specification, with values between 0 and 1
340+
*/
341+
static void createAnchorPointElement( QDomDocument &doc, QDomElement &element, QPointF anchor );
342+
335343
static void createOnlineResourceElement( QDomDocument &doc, QDomElement &element, const QString &path, const QString &format );
336344
static bool onlineResourceFromSldElement( QDomElement &element, QString &path, QString &format );
337345

‎tests/src/python/test_qgssymbollayer_createsld.py

Lines changed: 658 additions & 56 deletions
Large diffs are not rendered by default.
Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
2+
<qgis simplifyAlgorithm="0" hasScaleBasedVisibilityFlag="0" maxScale="0" mincale="1e+08" simplifyDrawingHints="1" simplifyLocal="1" version="2.99.0-Master" readOnly="0" simplifyDrawingTol="1" simplifyMaxScale="1">
3+
<renderer-v2 forceraster="0" enableorderby="0" symbollevels="0" type="singleSymbol">
4+
<symbols>
5+
<symbol name="0" alpha="1" type="line" clip_to_extent="1">
6+
<layer locked="0" class="SimpleLine" pass="0" enabled="1">
7+
<prop v="square" k="capstyle"/>
8+
<prop v="5;2" k="customdash"/>
9+
<prop v="3x:0,0,0,0,0,0" k="customdash_map_unit_scale"/>
10+
<prop v="MM" k="customdash_unit"/>
11+
<prop v="0" k="draw_inside_polygon"/>
12+
<prop v="bevel" k="joinstyle"/>
13+
<prop v="198,33,179,255" k="line_color"/>
14+
<prop v="solid" k="line_style"/>
15+
<prop v="0.26" k="line_width"/>
16+
<prop v="MM" k="line_width_unit"/>
17+
<prop v="0" k="offset"/>
18+
<prop v="3x:0,0,0,0,0,0" k="offset_map_unit_scale"/>
19+
<prop v="MM" k="offset_unit"/>
20+
<prop v="0" k="use_custom_dash"/>
21+
<prop v="3x:0,0,0,0,0,0" k="width_map_unit_scale"/>
22+
<data_defined_properties>
23+
<Option type="Map">
24+
<Option name="name" value="" type="QString"/>
25+
<Option name="properties"/>
26+
<Option name="type" value="collection" type="QString"/>
27+
</Option>
28+
</data_defined_properties>
29+
</layer>
30+
</symbol>
31+
</symbols>
32+
<rotation/>
33+
<sizescale/>
34+
</renderer-v2>
35+
<labeling type="simple">
36+
<settings>
37+
<text-style namedStyle="Regular" fontSize="10" fontLetterSpacing="0" multilineHeight="1" fontWordSpacing="0" useSubstitutions="0" fontUnderline="0" previewBkgrdColor="#ffffff" isExpression="0" fontWeight="50" fontCapitals="0" fieldName="name" textColor="0,0,0,255" textOpacity="1" fontStrikeout="0" fontFamily="Noto Sans" fontSizeMapUnitScale="3x:0,0,0,0,0,0" blendMode="0" fontSizeUnit="Point" fontItalic="0">
38+
<text-buffer bufferSize="1" bufferDraw="0" bufferColor="255,255,255,255" bufferJoinStyle="128" bufferSizeMapUnitScale="3x:0,0,0,0,0,0" bufferNoFill="1" bufferBlendMode="0" bufferSizeUnits="MM" bufferOpacity="1"/>
39+
<background shapeRotation="0" shapeBorderWidthUnit="MM" shapeOffsetMapUnitScale="3x:0,0,0,0,0,0" shapeRadiiY="0" shapeBorderWidth="0" shapeRadiiUnit="MM" shapeBorderColor="128,128,128,255" shapeBorderWidthMapUnitScale="3x:0,0,0,0,0,0" shapeOffsetX="0" shapeOffsetY="0" shapeJoinStyle="64" shapeSizeX="0" shapeRadiiMapUnitScale="3x:0,0,0,0,0,0" shapeSizeY="0" shapeRotationType="0" shapeSizeUnit="MM" shapeBlendMode="0" shapeDraw="0" shapeSizeType="0" shapeRadiiX="0" shapeSVGFile="" shapeOffsetUnit="MM" shapeSizeMapUnitScale="3x:0,0,0,0,0,0" shapeFillColor="255,255,255,255" shapeType="0" shapeOpacity="1"/>
40+
<shadow shadowOffsetAngle="135" shadowOffsetGlobal="1" shadowOffsetDist="1" shadowOffsetMapUnitScale="3x:0,0,0,0,0,0" shadowDraw="0" shadowUnder="0" shadowOpacity="0.7" shadowOffsetUnit="MM" shadowRadiusMapUnitScale="3x:0,0,0,0,0,0" shadowBlendMode="6" shadowRadiusAlphaOnly="0" shadowScale="100" shadowRadius="1.5" shadowRadiusUnit="MM" shadowColor="0,0,0,255"/>
41+
<substitutions/>
42+
</text-style>
43+
<text-format placeDirectionSymbol="0" multilineAlign="4294967295" wrapChar="" rightDirectionSymbol=">" leftDirectionSymbol="&lt;" plussign="0" formatNumbers="0" reverseDirectionSymbol="0" addDirectionSymbol="0" decimals="3"/>
44+
<placement rotationAngle="0" dist="0" priority="5" placement="2" placementFlags="10" labelOffsetInMapUnits="1" quadOffset="4" repeatDistanceUnit="1" distInMapUnits="0" centroidWhole="0" yOffset="0" centroidInside="0" maxCurvedCharAngleIn="25" repeatDistanceMapUnitScale="3x:0,0,0,0,0,0" distMapUnitScale="3x:0,0,0,0,0,0" maxCurvedCharAngleOut="-25" labelOffsetMapUnitScale="3x:0,0,0,0,0,0" xOffset="0" repeatDistance="0" predefinedPositionOrder="TR,TL,BR,BL,R,L,TSR,BSR" preserveRotation="1" fitInPolygonOnly="0" offsetType="0"/>
45+
<rendering obstacle="1" zIndex="0" mergeLines="0" scaleVisibility="0" limitNumLabels="0" maxNumLabels="2000" drawLabels="1" scaleMax="0" fontLimitPixelSize="0" fontMinPixelSize="3" minFeatureSize="0" labelPerPart="0" obstacleFactor="1" displayAll="0" obstacleType="0" scaleMin="0" upsidedownLabels="0" fontMaxPixelSize="10000"/>
46+
<dd_properties>
47+
<Option type="Map">
48+
<Option name="name" value="" type="QString"/>
49+
<Option name="properties"/>
50+
<Option name="type" value="collection" type="QString"/>
51+
</Option>
52+
</dd_properties>
53+
</settings>
54+
</labeling>
55+
<customproperties>
56+
<property value="0" key="embeddedWidgets/count"/>
57+
<property key="variableNames"/>
58+
<property key="variableValues"/>
59+
</customproperties>
60+
<blendMode>0</blendMode>
61+
<featureBlendMode>0</featureBlendMode>
62+
<layerOpacity>1</layerOpacity>
63+
<SingleCategoryDiagramRenderer sizeLegend="0" diagramType="Histogram" attributeLegend="1">
64+
<DiagramCategory sizeType="MM" opacity="1" scaleBasedVisibility="0" width="15" backgroundColor="#ffffff" enabled="0" penAlpha="255" lineSizeScale="3x:0,0,0,0,0,0" penWidth="0" scaleDependency="Area" rotationOffset="270" lineSizeType="MM" labelPlacementMethod="XHeight" backgroundAlpha="255" barWidth="5" penColor="#000000" minScaleDenominator="0" sizeScale="3x:0,0,0,0,0,0" minimumSize="0" maxScaleDenominator="1e+08" diagramOrientation="Up" height="15">
65+
<fontProperties style="" description="Noto Sans,9,-1,5,50,0,0,0,0,0"/>
66+
</DiagramCategory>
67+
<symbol name="sizeSymbol" alpha="1" type="marker" clip_to_extent="1">
68+
<layer locked="0" class="SimpleMarker" pass="0" enabled="1">
69+
<prop v="0" k="angle"/>
70+
<prop v="255,0,0,255" k="color"/>
71+
<prop v="1" k="horizontal_anchor_point"/>
72+
<prop v="bevel" k="joinstyle"/>
73+
<prop v="circle" k="name"/>
74+
<prop v="0,0" k="offset"/>
75+
<prop v="3x:0,0,0,0,0,0" k="offset_map_unit_scale"/>
76+
<prop v="MM" k="offset_unit"/>
77+
<prop v="0,0,0,255" k="outline_color"/>
78+
<prop v="solid" k="outline_style"/>
79+
<prop v="0" k="outline_width"/>
80+
<prop v="3x:0,0,0,0,0,0" k="outline_width_map_unit_scale"/>
81+
<prop v="MM" k="outline_width_unit"/>
82+
<prop v="diameter" k="scale_method"/>
83+
<prop v="2" k="size"/>
84+
<prop v="3x:0,0,0,0,0,0" k="size_map_unit_scale"/>
85+
<prop v="MM" k="size_unit"/>
86+
<prop v="1" k="vertical_anchor_point"/>
87+
<data_defined_properties>
88+
<Option type="Map">
89+
<Option name="name" value="" type="QString"/>
90+
<Option name="properties"/>
91+
<Option name="type" value="collection" type="QString"/>
92+
</Option>
93+
</data_defined_properties>
94+
</layer>
95+
</symbol>
96+
</SingleCategoryDiagramRenderer>
97+
<DiagramLayerSettings placement="2" obstacle="0" showAll="1" priority="0" dist="0" zIndex="0" linePlacementFlags="18">
98+
<properties>
99+
<Option type="Map">
100+
<Option name="name" value="" type="QString"/>
101+
<Option name="properties"/>
102+
<Option name="type" value="collection" type="QString"/>
103+
</Option>
104+
</properties>
105+
</DiagramLayerSettings>
106+
<fieldConfiguration>
107+
<field name="dissolve">
108+
<editWidget type="TextEdit">
109+
<config>
110+
<Option/>
111+
</config>
112+
</editWidget>
113+
</field>
114+
<field name="scalerank">
115+
<editWidget type="Range">
116+
<config>
117+
<Option/>
118+
</config>
119+
</editWidget>
120+
</field>
121+
<field name="featurecla">
122+
<editWidget type="TextEdit">
123+
<config>
124+
<Option/>
125+
</config>
126+
</editWidget>
127+
</field>
128+
<field name="name">
129+
<editWidget type="TextEdit">
130+
<config>
131+
<Option/>
132+
</config>
133+
</editWidget>
134+
</field>
135+
<field name="name_alt">
136+
<editWidget type="TextEdit">
137+
<config>
138+
<Option/>
139+
</config>
140+
</editWidget>
141+
</field>
142+
<field name="rivernum">
143+
<editWidget type="TextEdit">
144+
<config>
145+
<Option/>
146+
</config>
147+
</editWidget>
148+
</field>
149+
<field name="note">
150+
<editWidget type="TextEdit">
151+
<config>
152+
<Option/>
153+
</config>
154+
</editWidget>
155+
</field>
156+
</fieldConfiguration>
157+
<aliases>
158+
<alias name="" field="dissolve" index="0"/>
159+
<alias name="" field="scalerank" index="1"/>
160+
<alias name="" field="featurecla" index="2"/>
161+
<alias name="" field="name" index="3"/>
162+
<alias name="" field="name_alt" index="4"/>
163+
<alias name="" field="rivernum" index="5"/>
164+
<alias name="" field="note" index="6"/>
165+
</aliases>
166+
<excludeAttributesWMS/>
167+
<excludeAttributesWFS/>
168+
<defaults>
169+
<default field="dissolve" expression=""/>
170+
<default field="scalerank" expression=""/>
171+
<default field="featurecla" expression=""/>
172+
<default field="name" expression=""/>
173+
<default field="name_alt" expression=""/>
174+
<default field="rivernum" expression=""/>
175+
<default field="note" expression=""/>
176+
</defaults>
177+
<constraints>
178+
<constraint field="dissolve" unique_strength="0" notnull_strength="0" exp_strength="0" constraints="0"/>
179+
<constraint field="scalerank" unique_strength="0" notnull_strength="0" exp_strength="0" constraints="0"/>
180+
<constraint field="featurecla" unique_strength="0" notnull_strength="0" exp_strength="0" constraints="0"/>
181+
<constraint field="name" unique_strength="0" notnull_strength="0" exp_strength="0" constraints="0"/>
182+
<constraint field="name_alt" unique_strength="0" notnull_strength="0" exp_strength="0" constraints="0"/>
183+
<constraint field="rivernum" unique_strength="0" notnull_strength="0" exp_strength="0" constraints="0"/>
184+
<constraint field="note" unique_strength="0" notnull_strength="0" exp_strength="0" constraints="0"/>
185+
</constraints>
186+
<constraintExpressions>
187+
<constraint field="dissolve" desc="" exp=""/>
188+
<constraint field="scalerank" desc="" exp=""/>
189+
<constraint field="featurecla" desc="" exp=""/>
190+
<constraint field="name" desc="" exp=""/>
191+
<constraint field="name_alt" desc="" exp=""/>
192+
<constraint field="rivernum" desc="" exp=""/>
193+
<constraint field="note" desc="" exp=""/>
194+
</constraintExpressions>
195+
<attributeactions>
196+
<defaultAction value="{00000000-0000-0000-0000-000000000000}" key="Canvas"/>
197+
</attributeactions>
198+
<attributetableconfig sortExpression="" actionWidgetStyle="dropDown" sortOrder="0">
199+
<columns>
200+
<column name="dissolve" hidden="0" type="field" width="-1"/>
201+
<column name="scalerank" hidden="0" type="field" width="-1"/>
202+
<column name="featurecla" hidden="0" type="field" width="-1"/>
203+
<column name="name" hidden="0" type="field" width="-1"/>
204+
<column name="name_alt" hidden="0" type="field" width="-1"/>
205+
<column name="rivernum" hidden="0" type="field" width="-1"/>
206+
<column name="note" hidden="0" type="field" width="-1"/>
207+
<column hidden="1" type="actions" width="-1"/>
208+
</columns>
209+
</attributetableconfig>
210+
<editform></editform>
211+
<editforminit/>
212+
<editforminitcodesource>0</editforminitcodesource>
213+
<editforminitfilepath></editforminitfilepath>
214+
<editforminitcode><![CDATA[# -*- coding: utf-8 -*-
215+
"""
216+
QGIS forms can have a Python function that is called when the form is
217+
opened.
218+
219+
Use this function to add extra logic to your forms.
220+
221+
Enter the name of the function in the "Python Init function"
222+
field.
223+
An example follows:
224+
"""
225+
from qgis.PyQt.QtWidgets import QWidget
226+
227+
def my_form_open(dialog, layer, feature):
228+
geom = feature.geometry()
229+
control = dialog.findChild(QWidget, "MyLineEdit")
230+
]]></editforminitcode>
231+
<featformsuppress>0</featformsuppress>
232+
<editorlayout>generatedlayout</editorlayout>
233+
<widgets/>
234+
<conditionalstyles>
235+
<rowstyles/>
236+
<fieldstyles/>
237+
</conditionalstyles>
238+
<expressionfields/>
239+
<previewExpression>name</previewExpression>
240+
<mapTip></mapTip>
241+
<layerGeometryType>1</layerGeometryType>
242+
</qgis>

‎tests/testdata/symbol_layer/polygonLabel.qml

Lines changed: 910 additions & 0 deletions
Large diffs are not rendered by default.

‎tests/testdata/symbol_layer/simpleLabel.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<property key="labeling/bufferColorB" value="255"/>
5252
<property key="labeling/bufferColorG" value="255"/>
5353
<property key="labeling/bufferColorR" value="255"/>
54-
<property key="labeling/bufferDraw" value="true"/>
54+
<property key="labeling/bufferDraw" value="false"/>
5555
<property key="labeling/bufferJoinStyle" value="128"/>
5656
<property key="labeling/bufferNoFill" value="false"/>
5757
<property key="labeling/bufferSize" value="1"/>
@@ -97,7 +97,7 @@
9797
<property key="labeling/minFeatureSize" value="0"/>
9898
<property key="labeling/multilineAlign" value="3"/>
9999
<property key="labeling/multilineHeight" value="1"/>
100-
<property key="labeling/namedStyle" value="Bold Italic"/>
100+
<property key="labeling/namedStyle" value="Regular"/>
101101
<property key="labeling/obstacle" value="true"/>
102102
<property key="labeling/obstacleFactor" value="1"/>
103103
<property key="labeling/obstacleType" value="0"/>

0 commit comments

Comments
 (0)
Please sign in to comment.