<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Thank you for the idea! The goal is to sneakily jump in when the
user is adding any layer though (without them caring about
anything, without any rules they have to follow). I'll post our
solution in the main thread in a moment.</p>
<p>Cheers, Hannes<br>
</p>
<div class="moz-cite-prefix">Am 22.08.22 um 12:11 schrieb Jacky
Volpes:<br>
</div>
<blockquote type="cite"
cite="mid:ebf76fef-0374-329a-ea7e-d6c7bdb8bf03@oslandia.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<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"
moz-do-not-send="true">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 moz-txt-link-freetext" href="mailto:QGIS-Developer@lists.osgeo.org" moz-do-not-send="true">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" moz-do-not-send="true">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" moz-do-not-send="true">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>
</blockquote>
<pre class="moz-signature" cols="72">--
Johannes Kröger / GIS-Entwickler/-Berater
---------------------------------------------
Schon gewusst?
In unserem Blog geben wir Tipps & Tricks zu Open-Source-GIS-Software
und berichten aus unserem Experten-Alltag:
<a class="moz-txt-link-freetext" href="https://wheregroup.com/blog/">https://wheregroup.com/blog/</a>
---------------------------------------------
WhereGroup GmbH
Grevenweg 89
20537 Hamburg
Germany
Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11
<a class="moz-txt-link-abbreviated" href="mailto:johannes.kroeger@wheregroup.com">johannes.kroeger@wheregroup.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.wheregroup.com">www.wheregroup.com</a>
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------------------------
</pre>
</body>
</html>