Skip to content

Commit ba8a60f

Browse files
committedOct 21, 2014
Fix #11456 (canvas not refreshed anymore after adding a new feature)
Resorted to a "minimalist" fix - other solutions would potentially break even more stuff. The handling of non-modal dialogs for add/edit feature attributes + handling of isModified() should be addressed at some point.
1 parent aa46df2 commit ba8a60f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎src/gui/qgsattributeform.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ bool QgsAttributeForm::save()
133133

134134
mIsSaving = true;
135135

136+
bool changedLayer = false;
137+
136138
bool success = true;
137139

138140
emit beforeSave( success );
@@ -194,6 +196,7 @@ bool QgsAttributeForm::save()
194196
{
195197
mFeature.setAttributes( updatedFeature.attributes() );
196198
mLayer->endEditCommand();
199+
changedLayer = true;
197200
}
198201
else
199202
mLayer->destroyEditCommand();
@@ -226,6 +229,7 @@ bool QgsAttributeForm::save()
226229
{
227230
mLayer->endEditCommand();
228231
mFeature.setAttributes( dst );
232+
changedLayer = true;
229233
}
230234
else
231235
{
@@ -237,12 +241,13 @@ bool QgsAttributeForm::save()
237241

238242
emit featureSaved( updatedFeature );
239243

240-
// [MD] disabled trigger of repaint as it interferes with other stuff (#11361).
244+
// [MD] Refresh canvas only when absolutely necessary - it interferes with other stuff (#11361).
241245
// This code should be revisited - and the signals should be fired (+ layer repainted)
242246
// only when actually doing any changes. I am unsure if it is actually a good idea
243247
// to call save() whenever some code asks for vector layer's modified status
244248
// (which is the case when attribute table is open)
245-
//mLayer->triggerRepaint();
249+
if ( changedLayer )
250+
mLayer->triggerRepaint();
246251

247252
mIsSaving = false;
248253

0 commit comments

Comments
 (0)
Please sign in to comment.