[QGIS-Developer] Using embedded widgets in the layer tree on a python plugin

Ricardo Filipe Soares Garcia da ricardo.garcia.silva at gmail.com
Wed Sep 26 15:03:14 PDT 2018


Thanks for the feedback.

I've opened the relevant tickets in the bug tracker:

https://issues.qgis.org/issues/19960
https://issues.qgis.org/issues/19964

Might take a stab at a fix myself, if I can spare some free time.


Martin Dobias <wonder.sk at gmail.com> escreveu no dia quarta, 26/09/2018 à(s)
20:30:

> Hi Ricardo
>
> Sorry for the delayed answer...
>
> On Mon, Sep 17, 2018 at 12:10 AM Ricardo Filipe Soares Garcia da
> <ricardo.garcia.silva at gmail.com> wrote:
> >
> > This code kind of works, but I'm facing two problems at the moment:
> >
> > 1. The `MyWidgetProvider.supportsLayer()` method is never called. The
> logging call does not show up on the console and I also see that my
> provider is offered on WMS layers, but also on some local vector layers
> (which is not what I intend). grep'ping around the QGIS' source code I
> could not find some place where this method would be called and used, so
> I'm wondering if this is implemented. I would expect this method to be
> called when the layer properties dialog is opened, so that my provider
> would get filtered out for layers that were of the wrong type;
> >
> > 2. This code does not update the legend for the layer, UNLESS it is a
> vector layer. If I try to add this provider to a WMS layer, the legend is
> not updated. If I add it to a shapefile, it works as expected. In order to
> get my QLabel to show up on WMS layers, I have to manually run this in the
> QGIS python shell:
>
> I have looked into the code and figured out that both of these issues
> seem like bugs in the implementation. The supportLayer() method indeed
> seems unused (my test implementation always returned true, that
> explains I haven't realized it was not wired in) and the legend
> refresh of vector layer is probably done by some other part within the
> vector layer properties dialog, while in raster layer properties that
> does not happen. Feel free to report them in the bug tracker...
>
> Cheers
> Martin
>


-- 
___________________________ ___ __
Ricardo Garcia Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180926/0911f2a3/attachment.html>


More information about the QGIS-Developer mailing list