4

I have postgresql/postgis database setup with one to many relationship. I can successfully set it up in QGIS but I would like to keep related tables hidden from Layers Panel to keep the project "clean" since later on I might be adding more complex databases, value map tables etc..

For example, I have locations layer where each point can relate to several events in events layer. I would like to edit data in form like this so each location can be updated with new events only that events table would not be visible in Layers Panel:

enter image description here

Is there some way to achieve this without going into PyQGIS?

I am just starting with PyQGIS.

4
  • not 100% sure what you mean but I'm almost certain PostgreSQL Views (or Materialized Views) are what you want if you are working with in-DB joins only.
    – geozelot
    Commented Feb 11, 2019 at 13:01
  • Thanks for response, I Updated the question to make it clear what i want to achieve. Views, if i understand right, allow me to create joined tables and would multipy "locations" to match number of unique "events"/"location" combinations from my example and not allow me to use emebeded attribute tables in forms?
    – Mat
    Commented Feb 11, 2019 at 18:43
  • Why not create an updatable view in PostgreSQL ? More informations in the PG documentation : postgresql.org/docs/current/sql-createview.html, Updatable Views section. Commented Feb 21, 2019 at 8:09
  • Natively I don't see any way of hiding a layer in the TOC without some pyqgis. In the past I have all the lists stored away in a TOC group. A Virtual Layer can embed a table so it is not visibly in the TOC, but you can not use them in a value map relation.
    – Jakob
    Commented Feb 21, 2019 at 8:35

1 Answer 1

4

You need QGIS v3.18 or higher.

Go to Project --> Properties... --> Data Sources and check the layers you want to hide from the Layers Panel (column Private).

enter image description here

If you want to see Private (hidden) layers again, you could revert the aforementioned action (i.e., uncheck the layer in the Properties dialog) or do this:

enter image description here


Note: You can make both spatial and non spatial layers 'Private'.

1
  • Is there a way to this dynamically rather than having to select the layers you want private? In the TOC can you just hide layers that are not turned on?
    – Kapanther
    Commented Feb 14 at 2:58

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.