I am using QGIS 3.

I know that i can right click the layer and check the "show feature" option but is it possible to show enable this function by default when any layer is loaded ?

I know that we can set the project. I am looking for option to show it all time. a plugin for it will do.

  • as a note, including Show Feature Count for each layer in a project can result in extended load times as QGIS has to recount each layer when the project is open. – Hugh_Kelley Jun 16 '20 at 16:33

You can use the following code in the Python Console, script or plugin which sets the featureCount setting to be enabled for any loaded vector layer:

def showFeatureCount(layers):
    layer = layers[0]
    if layer.type() == QgsMapLayer.VectorLayer:
        root = QgsProject.instance().layerTreeRoot()
        myLayerNode = root.findLayer(layer.id())
        myLayerNode.setCustomProperty("showFeatureCount", True)


If you want this to work from startup, you can use a startup script (or a plugin) and use the code shown above in addition to importing the following modules:

from qgis.core import QgsMapLayer, QgsProject

Not the answer you're looking for? Browse other questions tagged or ask your own question.