[QGIS-Developer] get visibility from layout items with python

Nyall Dawson nyall.dawson at gmail.com
Thu Nov 8 17:46:44 PST 2018


On Thu, 8 Nov 2018 at 17:25, Raymond Nijssen <r.nijssen at terglobo.nl> wrote:
>
>
>
> On 08-11-18 08:20, Nyall Dawson wrote:
> > On Thu, 8 Nov 2018 at 17:18, Raymond Nijssen <r.nijssen at terglobo.nl> wrote:
> >
> >> I'm also using setVisible() now, instead of setVisibility(). But now I
> >> wonder why the latter exists.
> >
> > Check the API dox -- there's a specific note there that you need to
> > call setVisibility instead of setVisible, or visiblity won't work
> > correctly for some items (like groups).
>
> Thanks. I read that but I didn't get it. So I should use setVisibility()
> instead of setVisible(), right? (They both work on QgsLayoutItemLabel btw.)

Yes - it's safest just to use setVisibility everywhere.

Nyall

>
> >
> > (Unfortunately QGraphicsItem::setVisible is not virtual, so we can't
> > override that... hence the ugly api here).
>
> Ok, clear.
> >
> > Nyall
> >


More information about the QGIS-Developer mailing list