[QGIS-Developer] QgsLayout.itemById returns wrong object

Alexander Bruy alexander.bruy at gmail.com
Tue Jan 23 06:04:04 PST 2018


2018-01-23 14:34 GMT+02:00 Enrico Ferreguti <enricofer at gmail.com>:
> from qgis.core import QgsProject
> myLayout = QgsProject.instance().layoutManager().layoutByName('test')
> myLayoutPicture = myLayout.itemById("picture")
> myLayoutPicture.setPicturePath("path to an image")
>
> and I get the following Exception:
> AttributeError: 'QgsLayoutItem' object has no attribute 'setPicturePath'

Which QGIS revision do you use? I can not reproduce your issue on master,
all works as expected.

-- 
Alexander Bruy


More information about the QGIS-Developer mailing list