[QGIS-Developer] Problems with QgsProviderRegistry providerMetadata method

Alessandro Pasotti apasotti at gmail.com
Mon Oct 25 02:54:15 PDT 2021


Hi Bo,

Is that with or without `cached` ?

QMap<QString, QgsAbstractProviderConnection *> connections( bool cached = true )




On Mon, Oct 25, 2021 at 11:46 AM Bo Victor Thomsen <
bo.victor.thomsen at gmail.com> wrote:

> Hi list members -
>
> I stumbled on something weird (for me at least):
>
> If I run the following code in the Python console:
>
> metadata = QgsProviderRegistry.instance().providerMetadata('postgres')
> conn = metadata.connections()
> for c in conn.keys(): print(c)
>
> It shows me (as I would expect): A list of names of postgres connections
> in QGIS.
>
> However, if I 1) Make a *new* postgres connection and 2) Rerun the same
> lines in the console, the new connection is *not* shown in the list.
>
> But if I restart QGIS and run the same code, the new connection will be
> shown together with the older connections.
>
> What gives ? Is there some kind of "refresh" method I've overlooked??
>
> Version: QGIS 3.20.3 on Windows 10.
>
>
> --
> Med venlig hilsen / Kind regards
>
> Bo Victor Thomsen
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>


-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20211025/62c7717a/attachment.html>


More information about the QGIS-Developer mailing list