File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -2767,7 +2767,18 @@ long QgsVectorLayer::featureCount() const
2767
2767
2768
2768
QgsFeatureSource::FeatureAvailability QgsVectorLayer::hasFeatures () const
2769
2769
{
2770
- if ( mDataProvider ->empty () && ( !mEditBuffer || mEditBuffer ->addedFeatures ().empty () ) )
2770
+ const QgsFeatureIds deletedFeatures = mEditBuffer ->deletedFeatureIds ();
2771
+ const QgsFeatureMap addedFeatures = mEditBuffer ->addedFeatures ();
2772
+
2773
+ if ( mEditBuffer && !deletedFeatures.empty () )
2774
+ {
2775
+ if ( addedFeatures.size () > deletedFeatures.size () )
2776
+ return QgsFeatureSource::FeatureAvailability::FeaturesAvailable;
2777
+ else
2778
+ return QgsFeatureSource::FeatureAvailability::FeaturesMaybeAvailable;
2779
+ }
2780
+
2781
+ if ( ( !mEditBuffer || addedFeatures.empty () ) && mDataProvider ->empty () )
2771
2782
return QgsFeatureSource::FeatureAvailability::NoFeaturesAvailable;
2772
2783
else
2773
2784
return QgsFeatureSource::FeatureAvailability::FeaturesAvailable;
You can’t perform that action at this time.
0 commit comments