On 7 January 2018 at 08:13, Enrico Ferreguti <[email protected]> wrote:
> I'm trying to set programmatically a QgsComposerPicture content in QGIS2.99:
>
> 1) I create a new print composition and I name it 'test'
> 2) I create a picture frame in the composition and I call it 'picture'
> 3) I run the following code:
>
> from qgis.core import QgsProject
> myComposition =
> QgsProject.instance().layoutManager().compositionByName('test')
> myComposerPicture = myComposition.getComposerItemById("picture")
> myComposerPicture.setPicturePath("[path to an image]")
>
> and I get the following Exception:
> AttributeError: 'QgsComposerItem' object has no attribute 'setPicturePath'
>
> If I inspect myComposerPicture object I found it is a
> qgis._core.QgsComposerItem not a QgsComposerPicture
>
> Is this a correct behaviour or is it an issue?
> Should I open a issue ticket?

If your script is targeting QGIS 3.0, please don't file bugs against
composer. You need to use the newer layouts engine instead (QgsLayout
and associated classes).

Over the coming week all composer code will be removed from QGIS.

Nyall

>
>
> _______________________________________________
> QGIS-Developer mailing list
> [email protected]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to