I have a number of layers in the Layers Panel inside a group but I don't want them shown (there's quite a lot so it looks untidy). These layers are also joined to several others.

Is it possible to make these layers invisible to the user (i.e. not shown in the Layers Panel, it is not about setting the visibility of the layer) but can still be joined to other layers, or perhaps to make the group invisible?

Closest I found was this post but hoping there's a more direct approach:

Showing only some layers in QGIS legend?

1 Answer 1


Just to clarify, private/hidden layers/groups will not appear in the Layers Panel, but they can still be seen in the canvas or used in joins/relations with other layers.

Native approach (QGIS API)

You need at least QGIS v3.18.

Using the native approach, you can make a layer 'Private' (or hidden) in this way:

layer = iface.activeLayer()

See Making layer private/hidden/invisible in QGIS Layers Panel without Python to do this using the QGIS GUI.

However, using the native approach there is no way of making a layer group Private (or hidden). For that you would need the Plugin approach.

Plugin approach

You need at least QGIS v3.4.

I find making layers/groups hidden/invisible useful to avoid showing lookup tables, which are required for value relations but might make the Layers Panel look a bit overloaded.


Use the plugin Invisible layers and groups, which allows you to:

  • Make selected layers/groups hidden/invisible (plugin button).
  • Make layers/groups (that are hidden/invisible) visible again (plugin button).
  • Store layers/groups visibility in your QGIS project.
  • Recreate layers/groups visibility when opening your QGIS project.
  • Make a particular layer hidden/invisible (by code).
  • Make a particular group hidden/invisible (by code).

Making a layer hidden/invisible (by code):

if 'InvisibleLayersAndGroups' in qgis.utils.plugins:
    ilg = qgis.utils.plugins['InvisibleLayersAndGroups']
    ilg.hideLayer( layer )    # layer is a QgsMapLayer

Making a group hidden/invisible (by code):

if 'InvisibleLayersAndGroups' in qgis.utils.plugins:
    ilg = qgis.utils.plugins['InvisibleLayersAndGroups']
    ilg.hideGroup( group )    # group is a QgsLayerTreeGroup
    ilg.hideGroup( 'group2' ) # You can also pass a group name

Note: Depending on your use case, stick to one approach: either native or plugin, but don't use both at the same time.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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