I'm using this code to get features from QgsVectorLayer
QgsVectorDataProvider* provider=theVectorLayer->dataProvider();
if(!provider)
{
return;
}
theVectorLayer->select(provider->attributeIndexes(),theVectorLayer->extent(),true,false);
theVectorLayer->selectedFeatureCount();//here returns 0 but there is one polygon
while(theVectorLayer->nextFeature(currentFeature))
{
....//here Iget attributes and current geometry (one polygon)
}
How do I get feature count?
Method featureCount() returns -1.