Skip to content
Permalink
Browse files

[attrtable] No checks when the model is not based on a request

Huge speedup
Fix #9315
  • Loading branch information
m-kuhn committed Jan 30, 2014
1 parent 3ba33d7 commit d378f942a50ad25cc24570e125ea3724e09d79d6
Showing with 26 additions and 19 deletions.
  1. +0 −1 src/app/qgsfieldcalculator.cpp
  2. +26 −18 src/gui/attributetable/qgsattributetablemodel.cpp
@@ -194,7 +194,6 @@ void QgsFieldCalculator::accept()
rownum++;
}


if ( !calculationSuccess )
{
QMessageBox::critical( 0, tr( "Error" ), tr( "An error occured while evaluating the calculation string:\n%1" ).arg( error ) );
@@ -199,31 +199,39 @@ void QgsAttributeTableModel::layerDeleted()
void QgsAttributeTableModel::attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value )
{
QgsDebugMsgLevel( QString( "(%4) fid: %1, idx: %2, value: %3" ).arg( fid ).arg( idx ).arg( value.toString() ).arg( mFeatureRequest.filterType() ), 3 );
if ( loadFeatureAtId( fid ) )
// No filter request: skip all possibly heavy checks
if ( mFeatureRequest.filterType() == QgsFeatureRequest::FilterNone )
{
if ( mFeatureRequest.acceptFeature( mFeat ) )
setData( index( idToRow( fid ), fieldCol( idx ) ), value, Qt::EditRole );
}
else
{
if ( loadFeatureAtId( fid ) )
{
if ( !mIdRowMap.contains( fid ) )
if ( mFeatureRequest.acceptFeature( mFeat ) )
{
// Feature changed in such a way, it will be shown now
featureAdded( fid );
if ( !mIdRowMap.contains( fid ) )
{
// Feature changed in such a way, it will be shown now
featureAdded( fid );
}
else
{
if ( idx == mCachedField )
mFieldCache[ fid ] = value;
// Update representation
setData( index( idToRow( fid ), fieldCol( idx ) ), value, Qt::EditRole );
}
}
else
{
if ( idx == mCachedField )
mFieldCache[ fid ] = value;
// Update representation
setData( index( idToRow( fid ), fieldCol( idx ) ), value, Qt::EditRole );
}
}
else
{
if ( mIdRowMap.contains( fid ) )
{
// Feature changed such, that it is no longer shown
featureDeleted( fid );
if ( mIdRowMap.contains( fid ) )
{
// Feature changed such, that it is no longer shown
featureDeleted( fid );
}
// else: we don't care
}
// else: we don't care
}
}
}

0 comments on commit d378f94

Please sign in to comment.
You can’t perform that action at this time.