The original snippet: @staticmethod def get_composition_item(comp, item_id, item_class): for item in comp.items(): if isinstance(item, item_class): if item.id() == item_id: return item
2017-11-28 11:22 GMT+01:00 Etienne Trimaille <etienne.trimai...@gmail.com>: > 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 <sig...@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@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@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer