[QGIS-Developer] get visibility from layout items with python
Raymond Nijssen
r.nijssen at terglobo.nl
Wed Nov 7 23:18:16 PST 2018
On 08-11-18 08:08, Nyall Dawson wrote:
> On Thu, 8 Nov 2018 at 17:02, Raymond Nijssen <r.nijssen at terglobo.nl> wrote:
>>
>> In the python api, QgsLayoutItems have a setter for the visibility, but
>> i cannot find a way to retrieve the visibility setting.
>>
>> https://qgis.org/pyqgis/master/core/Layout/QgsLayoutItem.html
>>
>>
>> I would like to do this:
>>
>> item = QgsLayoutItemLabel() # I get this from my layout
>> checkbox.setChecked(item.visibility()) # this fails
>
> item.isVisible()
>
> It's from the base QGraphicsItem class.
>
> Nyall
>
Thanks Nyall, works!
I'm also using setVisible() now, instead of setVisibility(). But now I
wonder why the latter exists.
Raymond
More information about the QGIS-Developer
mailing list