[QGIS-Developer] QGIS 3 getComposerItemById should return subclassed item

SIGéal sigeal at sigeal.com
Tue Nov 28 05:45:18 PST 2017


print(lblTitle) gives "<qgis._core.QgsComposerItem object at 
0x0000029B1435FC18>"
as suggested the error message.

--
Christophe

Le 28/11/2017 à 14:25, SIGéal a écrit :
> Weird : lblTitle.type() returns "65639"...
> --
> Christophe
>
> Le 28/11/2017 à 11:47, Matthias Kuhn a écrit :
>>
>> I guess there's a problem with the %ConvertToSubClassCode in the sip 
>> file.
>>
>> What does lblTitle.type() give?
>>
>> Matthias
>>
>>
>> On 11/28/2017 11:22 AM, Etienne Trimaille wrote:
>>> We have this problem with QGIS 2.18 too in our plugin: 
>>> https://github.com/inasafe/inasafe/issues/4271
>>>
>>> We could fix the problem with a hint from Martin, we have this 
>>> function as a workaround:
>>> https://github.com/inasafe/inasafe/blob/develop/safe/report/processors/default.py#L54
>>> It works well. It would be nice to know if it's a bug in QGIS.
>>>
>>> Etienne
>>>
>>> 2017-11-28 11:06 GMT+01:00 SIGéal <sigeal at sigeal.com 
>>> <mailto:sigeal at sigeal.com>>:
>>>
>>>     Hi devs,
>>>
>>>     This code used to work in QGIS 2.x.
>>>
>>>     |lblTitle =myComposition.getComposerItemById('title')|||lblTitle|.setText('New Title')|
>>>
>>>     |However, it doesn't anymore in QGIS |2.99.
>>>     Instead it returns this error :
>>>
>>>     |'QgsComposerItem' object has no attribute 'setText'|||
>>>
>>>     --
>>>     Christophe
>>>
>>>
>>>
>>>     _______________________________________________
>>>     QGIS-Developer mailing list
>>>     QGIS-Developer at lists.osgeo.org
>>>     <mailto:QGIS-Developer at lists.osgeo.org>
>>>     List info:
>>>     https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>     <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
>>>     Unsubscribe:
>>>     https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>     <https://lists.osgeo.org/mailman/listinfo/qgis-developer>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> QGIS-Developer mailing list
>>> QGIS-Developer at lists.osgeo.org
>>> List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>> Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>>
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20171128/1a67bb03/attachment-0001.html>


More information about the QGIS-Developer mailing list