[Qgis-user] Display number of features present in layer's Attribute Table
Andrea Giudiceandrea
andreaerdna at libero.it
Thu Feb 4 00:17:30 PST 2021
Ann Tulliani wrote
> The one proposed workaround I found online
> is https://gis.stackexchange.com/questions/318190/setting-qgis-to-show-feature-count-always-when-layer-is-loaded.
> Following it, inside my /home/tulliani/.qgis2/python/startup.py I have:
Hi Ann,
are you using QGIS 2.x?
Ann Tulliani wrote
> Does anyone have any suggestions on how to update that code to make it
> work for multiple addition of layers?
You could try with:
def showFeatureCount(layers):
for layer in layers:
if layer.type() == QgsMapLayer.VectorLayer:
root = QgsProject.instance().layerTreeRoot()
myLayerNode = root.findLayer(layer.id())
myLayerNode.setCustomProperty("showFeatureCount", True)
Regards.
Andrea Giudiceandrea
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
More information about the Qgis-user
mailing list