Hi Song,
It is simply: layout.items()
For example, you can do this:
p = QgsProject.instance()
lom = p.layoutManager()
lo = lom.layoutByName(u'a4')
print(lo.items())
And then this to get all the labels:
for item in lo.items():
if isinstance(item, QgsLayoutItemLabel):
print(item)
There was a bug in the item classes recently but it has been fixed in v3.4
Good luck!
Raymond
On 17-11-18 07:56, Song Wendong wrote:
We want to make a function that send all items (mainly labels) to
browser and let user set the cotent, then send it back to server and
export as pdf.
I can only find |itemById|
<https://qgis.org/pyqgis/master/core/Layout/QgsLayout.html#qgis.core.QgsLayout.itemById>and
|itemByUuid|
<https://qgis.org/pyqgis/master/core/Layout/QgsLayout.html#qgis.core.QgsLayout.itemByUuid>,
but there are all kinds of layouts.
Is there a way to get all items and their ids?
_______________________________________________
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
--
Terglobo
Fahrenheitstraat 1
5223 BJ 's-Hertogenbosch
The Netherlands
+31 (0) 6 25 31 49 83
_______________________________________________
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