Skip to content
Permalink
Browse files

Update feature count on layer modification (Fix #8445)

  • Loading branch information
jdvaz authored and m-kuhn committed Aug 19, 2013
1 parent 768cc1a commit 5e4a42ebb9423906ba90d6255b8c9d10ce0e5c20
Showing with 11 additions and 2 deletions.
  1. +2 −2 src/app/legend/qgslegendlayer.cpp
  2. +6 −0 src/core/qgsvectorlayer.cpp
  3. +3 −0 src/core/qgsvectorlayer.h
@@ -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;
}
@@ -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 ) ) );
@@ -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();
@@ -1305,6 +1305,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
*/
virtual void onCacheImageDelete();

protected slots:
void invalidateSymbolCountedFlag();

signals:

/**

0 comments on commit 5e4a42e

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