Skip to content

Commit 5e4a42e

Browse files
jdvazm-kuhn
authored andcommittedAug 19, 2013
Update feature count on layer modification (Fix #8445)
1 parent 768cc1a commit 5e4a42e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed
 

‎src/app/legend/qgslegendlayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,9 @@ QString QgsLegendLayer::label()
496496
{
497497
QString name = mLyr.layer()->name();
498498
QgsVectorLayer *vlayer = dynamic_cast<QgsVectorLayer *>( mLyr.layer() );
499-
if ( mShowFeatureCount && vlayer && vlayer->featureCount() >= 0 )
499+
if ( mShowFeatureCount && vlayer && vlayer->pendingFeatureCount() >= 0 )
500500
{
501-
name += QString( " [%1]" ).arg( vlayer->featureCount() );
501+
name += QString( " [%1]" ).arg( vlayer->pendingFeatureCount() );
502502
}
503503
return name;
504504
}

‎src/core/qgsvectorlayer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,7 @@ bool QgsVectorLayer::startEditing()
14981498

14991499
mEditBuffer = new QgsVectorLayerEditBuffer( this );
15001500
// forward signals
1501+
connect( mEditBuffer, SIGNAL( layerModified() ), this, SLOT( invalidateSymbolCountedFlag() ) );
15011502
connect( mEditBuffer, SIGNAL( layerModified() ), this, SIGNAL( layerModified() ) ); // TODO[MD]: necessary?
15021503
//connect( mEditBuffer, SIGNAL( layerModified() ), this, SLOT( triggerRepaint() ) ); // TODO[MD]: works well?
15031504
connect( mEditBuffer, SIGNAL( featureAdded( QgsFeatureId ) ), this, SIGNAL( featureAdded( QgsFeatureId ) ) );
@@ -3771,6 +3772,11 @@ void QgsVectorLayer::onCacheImageDelete()
37713772
mCurrentRendererContext->setRenderingStopped( true );
37723773
}
37733774

3775+
void QgsVectorLayer::invalidateSymbolCountedFlag()
3776+
{
3777+
mSymbolFeatureCounted = false;
3778+
}
3779+
37743780
QgsVectorLayer::ValueRelationData &QgsVectorLayer::valueRelation( int idx )
37753781
{
37763782
const QgsFields &fields = pendingFields();

‎src/core/qgsvectorlayer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
13051305
*/
13061306
virtual void onCacheImageDelete();
13071307

1308+
protected slots:
1309+
void invalidateSymbolCountedFlag();
1310+
13081311
signals:
13091312

13101313
/**

0 commit comments

Comments
 (0)
Please sign in to comment.