Skip to content
Permalink
Browse files
Fix issue 6899: Drag and drop designer uses first field after project…
… reload

idx was not properly initialized at project load.
  • Loading branch information
m-kuhn committed Jan 7, 2013
1 parent 314d144 commit 6b231a1e011017732edbfa1a63705ec1c3ba9d4b
Showing with 5 additions and 3 deletions.
  1. +1 −1 src/app/qgsfieldsproperties.cpp
  2. +3 −1 src/core/qgsvectorlayer.cpp
  3. +1 −1 src/core/qgsvectorlayer.h
@@ -752,7 +752,7 @@ QgsAttributeEditorElement* QgsFieldsProperties::createAttributeEditorWidget( QTr

if ( item->data( 0, Qt::UserRole ) == "field" )
{
int idx = *mLayer->dataProvider()->fieldNameMap().find( item->text( 0 ) );
int idx = *( mLayer->dataProvider()->fieldNameMap() ).find( item->text( 0 ) );
widgetDef = new QgsAttributeEditorField( item->text( 0 ), idx, parent );
}
else
@@ -3387,7 +3387,9 @@ QgsAttributeEditorElement* QgsVectorLayer::attributeEditorElementFromDomElement(
}
else if ( elem.tagName() == "attributeEditorField" )
{
newElement = new QgsAttributeEditorField( elem.attribute( "name" ), elem.attribute( "idx" ).toInt(), parent );
QString name = elem.attribute( "name" );
int idx = *( dataProvider()->fieldNameMap() ).find( name );
newElement = new QgsAttributeEditorField( name, idx, parent );
}

return newElement;
@@ -389,7 +389,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
* @param elem the DOM element
* @param parent the QObject which will own this object
*/
static QgsAttributeEditorElement* attributeEditorElementFromDomElement( QDomElement &elem, QObject* parent );
QgsAttributeEditorElement* attributeEditorElementFromDomElement( QDomElement &elem, QObject* parent );

/** Read the symbology for the current layer from the Dom node supplied.
* @param node node that will contain the symbology definition for this layer.

0 comments on commit 6b231a1

Please sign in to comment.