QgsFeature feature; bool hasGeo = feature.hasGeometry(); // returns false because feature doesn't have geometry
QgsFeature feature = layer->getFeature(1); bool hasGeo = feature.hasGeometry(); // returns true if the feature has a geometryThis code retrieves a feature from a layer and checks if it has geometry associated with it using QgsFeature hasGeometry. Overall, QgsFeature hasGeometry is a useful method for checking whether or not a feature has a geometry associated with it. The package/library in which this method belongs is the QGIS C++ API.