Skip to content

Commit

Permalink
attribute form: lookup attribute fields by name. joined layers might …
Browse files Browse the repository at this point in the history
…be unavailable at load time (fixes #12146)
  • Loading branch information
jef-n committed Feb 22, 2015
1 parent 789435d commit 61555f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -1758,7 +1758,7 @@ QgsAttributeEditorElement* QgsVectorLayer::attributeEditorElementFromDomElement(
for ( int i = 0; i < childNodeList.size(); i++ )
{
QDomElement childElem = childNodeList.at( i ).toElement();
QgsAttributeEditorElement* myElem = attributeEditorElementFromDomElement( childElem, container );
QgsAttributeEditorElement *myElem = attributeEditorElementFromDomElement( childElem, container );
if ( myElem )
container->addChildElement( myElem );
}
Expand All @@ -1768,7 +1768,7 @@ QgsAttributeEditorElement* QgsVectorLayer::attributeEditorElementFromDomElement(
else if ( elem.tagName() == "attributeEditorField" )
{
QString name = elem.attribute( "name" );
int idx = *( dataProvider()->fieldNameMap() ).find( name );
int idx = fieldNameIndex( name );
newElement = new QgsAttributeEditorField( name, idx, parent );
}
else if ( elem.tagName() == "attributeEditorRelation" )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsattributeform.cpp
Expand Up @@ -571,7 +571,7 @@ QWidget* QgsAttributeForm::createWidgetFromDef( const QgsAttributeEditorElement
if ( !fieldDef )
break;

int fldIdx = fieldDef->idx();
int fldIdx = vl->fieldNameIndex( fieldDef->name() );
if ( fldIdx < vl->pendingFields().count() && fldIdx >= 0 )
{
const QString widgetType = mLayer->editorWidgetV2( fldIdx );
Expand Down

0 comments on commit 61555f5

Please sign in to comment.