@@ -128,15 +128,13 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
128128 QGridLayout *mypInnerLayout = new QGridLayout ( mypInnerFrame );
129129
130130 int index = 0 ;
131- for ( QgsAttributeMap ::const_iterator it = myAttributes .begin (); it != myAttributes .end (); ++it )
131+ for ( QgsFieldMap ::const_iterator it = theFieldMap .begin (); it != theFieldMap .end (); ++it )
132132 {
133- const QgsField &field = theFieldMap[it.key ()];
134-
135133 // show attribute alias if available
136134 QString myFieldName = vl->attributeDisplayName ( it.key () );
137- int myFieldType = field. type ();
135+ int myFieldType = it-> type ();
138136
139- QWidget *myWidget = QgsAttributeEditor::createAttributeEditor ( 0 , 0 , vl, it.key (), it .value () );
137+ QWidget *myWidget = QgsAttributeEditor::createAttributeEditor ( 0 , 0 , vl, it.key (), myAttributes .value ( it. key (), QVariant () ) );
140138 if ( !myWidget )
141139 continue ;
142140
@@ -179,15 +177,13 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
179177 }
180178 else
181179 {
182- for ( QgsAttributeMap ::const_iterator it = myAttributes .begin (); it != myAttributes .end (); ++it )
180+ for ( QgsFieldMap ::const_iterator it = theFieldMap .begin (); it != theFieldMap .end (); ++it )
183181 {
184- const QgsField &field = theFieldMap[it.key ()];
185-
186- QWidget *myWidget = mDialog ->findChild <QWidget*>( field.name () );
182+ QWidget *myWidget = mDialog ->findChild <QWidget*>( it->name () );
187183 if ( !myWidget )
188184 continue ;
189185
190- QgsAttributeEditor::createAttributeEditor ( mDialog , myWidget, vl, it.key (), it .value () );
186+ QgsAttributeEditor::createAttributeEditor ( mDialog , myWidget, vl, it.key (), myAttributes .value ( it. key (), QVariant () ) );
191187
192188 if ( vl->editType ( it.key () ) != QgsVectorLayer::Immutable )
193189 {
@@ -348,9 +344,8 @@ void QgsAttributeDialog::accept()
348344 return ;
349345
350346 // write the new values back to the feature
351- QgsAttributeMap myAttributes = mFeature ->attributeMap ();
352347 int myIndex = 0 ;
353- for ( QgsAttributeMap ::const_iterator it = myAttributes .begin (); it != myAttributes .end (); ++it )
348+ for ( QgsFieldMap ::const_iterator it = mLayer -> pendingFields () .begin (); it != mLayer -> pendingFields () .end (); ++it )
354349 {
355350 QVariant value;
356351
0 commit comments