mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-12 00:02:25 -04:00
Fixes slow update in field calculator
by blocking the vector signals ... ... and emitting dataChanged at the end. I'm a bit worried of side effects, but I can't see any other solution. The root of the issue here is that for each changed field/row an attribute valueChanged signal is emitted, and the QgsVectorLayerCache::featureAtId loads the feature again.
This commit is contained in:
parent
42ea216478
commit
d79e3adf72
@ -164,7 +164,13 @@ void QgsFieldCalculator::accept()
|
||||
builder->saveToRecent( QStringLiteral( "fieldcalc" ) );
|
||||
|
||||
if ( ! mVectorLayer )
|
||||
{
|
||||
return;
|
||||
}
|
||||
else // Need a scope for the blocker let's keep the else for clarity
|
||||
{
|
||||
|
||||
QgsSignalBlocker<QgsVectorLayer> vectorBlocker( mVectorLayer );
|
||||
|
||||
// Set up QgsDistanceArea each time we (re-)calculate
|
||||
QgsDistanceArea myDa;
|
||||
@ -323,9 +329,11 @@ void QgsFieldCalculator::accept()
|
||||
mVectorLayer->destroyEditCommand();
|
||||
return;
|
||||
}
|
||||
|
||||
mVectorLayer->endEditCommand();
|
||||
}
|
||||
}
|
||||
// Vector signals unlocked! Tell the world that the layer has changed
|
||||
mVectorLayer->dataChanged();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user