<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font face="Ubuntu">Hi,<br>
      <br>
      I don't know any way to do this, except for using a workaround.<br>
      But it will depend on your use-case.<br>
      Maybe using query layers, such as <br>
      <br>
      QgsVectorLayer("table='(select * from <schema>.<table>
      <your conditions>)' service='<service>'
      key='<unique id column>'", "<table name>", "postgres")<br>
      <br>
    </font>can help ?<br>
    <br>
    Regards,<br>
    Jacky<br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">Le 09/08/2022 à 11:15, Johannes Kröger
      (WhereGroup) via QGIS-Developer a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:49942115-49f7-4a62-7ff0-aae691dd1be5@wheregroup.com">Howdy!
      <br>
      <br>
      I'd like to force a provider filter when a user adds a PostGIS
      layer and have it applied *before* any data is loaded. Setting it
      after the layer (and some of its big data) is loaded initially is
      not an option.
      <br>
      <br>
      Is there a way to sneak in between "user clicked something in the
      GUI to load a table/query and QGIS will construct a QgsVectorLayer
      now" and "QGIS now talks to the PostGIS database to get the data
      for the new layer", maybe with a signal?
      <br>
      <br>
      Something like a "layerAboutToBeLoaded" (like the opposite
      layerWillBeRemoved on
      <a class="moz-txt-link-freetext" href="https://qgis.org/pyqgis/master/core/QgsProject.html">https://qgis.org/pyqgis/master/core/QgsProject.html</a>) basically.
      :o)
      <br>
      <br>
      Cheers, Hannes
      <br>
      <br>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
QGIS-Developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Jacky Volpes

Ingénieur SIG - Oslandia</pre>
  </body>
</html>