[prev in list] [next in list] [prev in thread] [next in thread]
List: qgis-developer
Subject: Re: [QGIS-Developer] Inserting provider filter just before PostGIS layer is loaded?
From: Johannes_Kröger_(WhereGroup)_via_QGIS-Developer <qgis-devel
Date: 2022-08-30 16:10:14
Message-ID: 71a1cd53-8c7f-410c-51de-ab3e1a1d8dc0 () wheregroup ! com
[Download RAW message or body]
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
[Attachment #2 (multipart/mixed)]
[Attachment #4 (multipart/mixed)]
[Attachment #6 (text/plain)]
Thomas B sent me a suggestion off list and allowed me to share it:
QgsProject.layersAdded.connect(func) actually seems to emit in just the
right moment. This feels super finicky but so far it has worked
flawlessly to set the layer.setSubsetString() *before* the actual query
goes out to the DB. Hope I don't jinx it by posting ;)
Handle with care, and thanks Thomas!
Cheers, Hannes
Am 09.08.22 um 11:15 schrieb Johannes Kröger (WhereGroup) via
QGIS-Developer:
> Howdy!
>
> 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.
>
> 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?
>
> Something like a "layerAboutToBeLoaded" (like the opposite
> layerWillBeRemoved on
> https://qgis.org/pyqgis/master/core/QgsProject.html) basically. :o)
>
> Cheers, Hannes
["OpenPGP_0x840A4B843789797F.asc" (application/pgp-keys)]
["OpenPGP_signature.asc" (application/pgp-signature)]
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
--===============3938370532915698733==--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic