@@ -399,7 +399,7 @@ void QgsEditFormConfig::readXml( const QDomNode &node, QgsReadWriteContext &cont
399399 {
400400 QDomElement elem = attributeEditorFormNodeList.at ( i ).toElement ();
401401
402- QgsAttributeEditorElement *attributeEditorWidget = attributeEditorElementFromDomElement ( elem, nullptr );
402+ QgsAttributeEditorElement *attributeEditorWidget = attributeEditorElementFromDomElement ( elem, nullptr , node. namedItem ( QStringLiteral ( " id " ) ). toElement (). text () );
403403 addTab ( attributeEditorWidget );
404404 }
405405
@@ -518,13 +518,13 @@ void QgsEditFormConfig::writeXml( QDomNode &node, const QgsReadWriteContext &con
518518 // // END TODO
519519}
520520
521- QgsAttributeEditorElement *QgsEditFormConfig::attributeEditorElementFromDomElement ( QDomElement &elem, QgsAttributeEditorElement *parent )
521+ QgsAttributeEditorElement *QgsEditFormConfig::attributeEditorElementFromDomElement ( QDomElement &elem, QgsAttributeEditorElement *parent, const QString &layerId )
522522{
523523 QgsAttributeEditorElement *newElement = nullptr ;
524524
525525 if ( elem.tagName () == QLatin1String ( " attributeEditorContainer" ) )
526526 {
527- QgsAttributeEditorContainer *container = new QgsAttributeEditorContainer ( QgsProject::instance ()->translate ( QStringLiteral ( " project:layers:%1:formcontainers" ).arg ( " testdave " ), elem.attribute ( QStringLiteral ( " name" ) ) ), parent );
527+ QgsAttributeEditorContainer *container = new QgsAttributeEditorContainer ( QgsProject::instance ()->translate ( QStringLiteral ( " project:layers:%1:formcontainers" ).arg ( layerId ), elem.attribute ( QStringLiteral ( " name" ) ) ), parent );
528528 bool ok;
529529 int cc = elem.attribute ( QStringLiteral ( " columnCount" ) ).toInt ( &ok );
530530 if ( !ok )
@@ -551,7 +551,7 @@ QgsAttributeEditorElement *QgsEditFormConfig::attributeEditorElementFromDomEleme
551551 for ( int i = 0 ; i < childNodeList.size (); i++ )
552552 {
553553 QDomElement childElem = childNodeList.at ( i ).toElement ();
554- QgsAttributeEditorElement *myElem = attributeEditorElementFromDomElement ( childElem, container );
554+ QgsAttributeEditorElement *myElem = attributeEditorElementFromDomElement ( childElem, container, layerId );
555555 if ( myElem )
556556 container->addChildElement ( myElem );
557557 }
0 commit comments