@@ -214,6 +214,8 @@ void QgsEditorWidgetRegistry::readMapLayer( QgsMapLayer* mapLayer, const QDomEle
214
214
215
215
QDomNodeList editTypeNodes = layerElem.namedItem ( " edittypes" ).childNodes ();
216
216
217
+ QgsEditFormConfig formConfig = vectorLayer->editFormConfig ();
218
+
217
219
for ( int i = 0 ; i < editTypeNodes.size (); i++ )
218
220
{
219
221
QDomNode editTypeNode = editTypeNodes.at ( i );
@@ -230,27 +232,29 @@ void QgsEditorWidgetRegistry::readMapLayer( QgsMapLayer* mapLayer, const QDomEle
230
232
231
233
if ( mWidgetFactories .contains ( ewv2Type ) )
232
234
{
233
- vectorLayer-> editFormConfig () .setWidgetType ( idx, ewv2Type );
235
+ formConfig .setWidgetType ( idx, ewv2Type );
234
236
QDomElement ewv2CfgElem = editTypeElement.namedItem ( " widgetv2config" ).toElement ();
235
237
236
238
if ( !ewv2CfgElem.isNull () )
237
239
{
238
240
cfg = mWidgetFactories [ewv2Type]->readEditorConfig ( ewv2CfgElem, vectorLayer, idx );
239
241
}
240
242
241
- vectorLayer-> editFormConfig () .setReadOnly ( idx, ewv2CfgElem.attribute ( " fieldEditable" , " 1" ) != " 1" );
242
- vectorLayer-> editFormConfig () .setLabelOnTop ( idx, ewv2CfgElem.attribute ( " labelOnTop" , " 0" ) == " 1" );
243
- vectorLayer-> editFormConfig () .setNotNull ( idx, ewv2CfgElem.attribute ( " notNull" , " 0" ) == " 1" );
244
- vectorLayer-> editFormConfig () .setExpression ( idx, ewv2CfgElem.attribute ( " constraint" , QString () ) );
245
- vectorLayer-> editFormConfig () .setExpressionDescription ( idx, ewv2CfgElem.attribute ( " constraintDescription" , QString () ) );
243
+ formConfig .setReadOnly ( idx, ewv2CfgElem.attribute ( " fieldEditable" , " 1" ) != " 1" );
244
+ formConfig .setLabelOnTop ( idx, ewv2CfgElem.attribute ( " labelOnTop" , " 0" ) == " 1" );
245
+ formConfig .setNotNull ( idx, ewv2CfgElem.attribute ( " notNull" , " 0" ) == " 1" );
246
+ formConfig .setExpression ( idx, ewv2CfgElem.attribute ( " constraint" , QString () ) );
247
+ formConfig .setExpressionDescription ( idx, ewv2CfgElem.attribute ( " constraintDescription" , QString () ) );
246
248
247
- vectorLayer-> editFormConfig () .setWidgetConfig ( idx, cfg );
249
+ formConfig .setWidgetConfig ( idx, cfg );
248
250
}
249
251
else
250
252
{
251
253
QgsMessageLog::logMessage ( tr ( " Unknown attribute editor widget '%1'" ).arg ( ewv2Type ) );
252
254
}
253
255
}
256
+
257
+ vectorLayer->setEditFormConfig ( formConfig );
254
258
}
255
259
256
260
void QgsEditorWidgetRegistry::writeMapLayer ( QgsMapLayer* mapLayer, QDomElement& layerElem, QDomDocument& doc ) const
0 commit comments