Navigation Menu

Skip to content

Commit

Permalink
Update feature count on layer modification (Fix #8445)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdvaz authored and m-kuhn committed Aug 19, 2013
1 parent 768cc1a commit 5e4a42e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/legend/qgslegendlayer.cpp
Expand Up @@ -496,9 +496,9 @@ QString QgsLegendLayer::label()
{
QString name = mLyr.layer()->name();
QgsVectorLayer *vlayer = dynamic_cast<QgsVectorLayer *>( mLyr.layer() );
if ( mShowFeatureCount && vlayer && vlayer->featureCount() >= 0 )
if ( mShowFeatureCount && vlayer && vlayer->pendingFeatureCount() >= 0 )
{
name += QString( " [%1]" ).arg( vlayer->featureCount() );
name += QString( " [%1]" ).arg( vlayer->pendingFeatureCount() );
}
return name;
}
Expand Down
6 changes: 6 additions & 0 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -1498,6 +1498,7 @@ bool QgsVectorLayer::startEditing()

mEditBuffer = new QgsVectorLayerEditBuffer( this );
// forward signals
connect( mEditBuffer, SIGNAL( layerModified() ), this, SLOT( invalidateSymbolCountedFlag() ) );
connect( mEditBuffer, SIGNAL( layerModified() ), this, SIGNAL( layerModified() ) ); // TODO[MD]: necessary?
//connect( mEditBuffer, SIGNAL( layerModified() ), this, SLOT( triggerRepaint() ) ); // TODO[MD]: works well?
connect( mEditBuffer, SIGNAL( featureAdded( QgsFeatureId ) ), this, SIGNAL( featureAdded( QgsFeatureId ) ) );
Expand Down Expand Up @@ -3771,6 +3772,11 @@ void QgsVectorLayer::onCacheImageDelete()
mCurrentRendererContext->setRenderingStopped( true );
}

void QgsVectorLayer::invalidateSymbolCountedFlag()
{
mSymbolFeatureCounted = false;
}

QgsVectorLayer::ValueRelationData &QgsVectorLayer::valueRelation( int idx )
{
const QgsFields &fields = pendingFields();
Expand Down
3 changes: 3 additions & 0 deletions src/core/qgsvectorlayer.h
Expand Up @@ -1305,6 +1305,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
*/
virtual void onCacheImageDelete();

protected slots:
void invalidateSymbolCountedFlag();

signals:

/**
Expand Down

0 comments on commit 5e4a42e

Please sign in to comment.