Skip to content

Commit 7d636dd

Browse files
author
wonder
committed
Invalidate cache whenever the selection changes
git-svn-id: http://svn.osgeo.org/qgis/trunk@12189 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent c905427 commit 7d636dd

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/core/qgsvectorlayer.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,9 @@ void QgsVectorLayer::select( int number, bool emitSignal )
992992

993993
if ( emitSignal )
994994
{
995+
// invalidate cache
996+
setCacheImage( 0 );
997+
995998
emit selectionChanged();
996999
}
9971000
}
@@ -1002,6 +1005,9 @@ void QgsVectorLayer::deselect( int number, bool emitSignal )
10021005

10031006
if ( emitSignal )
10041007
{
1008+
// invalidate cache
1009+
setCacheImage( 0 );
1010+
10051011
emit selectionChanged();
10061012
}
10071013
}
@@ -1025,6 +1031,9 @@ void QgsVectorLayer::select( QgsRectangle & rect, bool lock )
10251031
select( f.id(), false ); // don't emit signal (not to redraw it everytime)
10261032
}
10271033

1034+
// invalidate cache
1035+
setCacheImage( 0 );
1036+
10281037
emit selectionChanged(); // now emit signal to redraw layer
10291038
}
10301039

@@ -1048,6 +1057,9 @@ void QgsVectorLayer::invertSelection()
10481057
mSelectedFeatureIds.remove( *iter );
10491058
}
10501059

1060+
// invalidate cache
1061+
setCacheImage( 0 );
1062+
10511063
emit selectionChanged();
10521064
}
10531065

@@ -1071,6 +1083,9 @@ void QgsVectorLayer::invertSelectionInRectangle( QgsRectangle & rect )
10711083
}
10721084
}
10731085

1086+
// invalidate cache
1087+
setCacheImage( 0 );
1088+
10741089
emit selectionChanged();
10751090
}
10761091

@@ -1079,7 +1094,12 @@ void QgsVectorLayer::removeSelection( bool emitSignal )
10791094
mSelectedFeatureIds.clear();
10801095

10811096
if ( emitSignal )
1097+
{
1098+
// invalidate cache
1099+
setCacheImage( 0 );
1100+
10821101
emit selectionChanged();
1102+
}
10831103
}
10841104

10851105
void QgsVectorLayer::triggerRepaint()
@@ -1765,6 +1785,9 @@ bool QgsVectorLayer::deleteSelectedFeatures()
17651785
deleteFeature( fid ); // removes from selection
17661786
}
17671787

1788+
// invalidate cache
1789+
setCacheImage( 0 );
1790+
17681791
emit selectionChanged();
17691792

17701793
triggerRepaint();
@@ -3355,6 +3378,10 @@ void QgsVectorLayer::setSelectedFeatures( const QgsFeatureIds& ids )
33553378
{
33563379
// TODO: check whether features with these ID exist
33573380
mSelectedFeatureIds = ids;
3381+
3382+
// invalidate cache
3383+
setCacheImage( 0 );
3384+
33583385
emit selectionChanged();
33593386
}
33603387

@@ -3448,6 +3475,9 @@ bool QgsVectorLayer::addFeatures( QgsFeatureList features, bool makeSelected )
34483475

34493476
if ( makeSelected )
34503477
{
3478+
// invalidate cache
3479+
setCacheImage( 0 );
3480+
34513481
emit selectionChanged();
34523482
}
34533483

0 commit comments

Comments
 (0)