[QGIS-Developer] Does QgsProject.instance().createEmbeddedGroup() work?

Alister Hood alister.hood at gmail.com
Sun Sep 18 20:40:24 PDT 2022


Hi, I want to programmatically embed a project, like I can in the gui with
"Layer>embed layers and groups."

I thought QgsProject.instance().createEmbeddedGroup() was what I needed,
but it doesn't seem to work - see below.  Am I completely off track, or is
it broken?

Thanks.

path='/home/alister/testtoembed.qgs'
project = QgsProject.instance()
project.read(path)
True
project.clear()
newGroup = QgsLayerTreeGroup()
type(newGroup)
<class 'qgis._core.QgsLayerTreeGroup'>
newGroup = QgsProject.instance().createEmbeddedGroup('test', path, [])
type(newGroup)
<class 'NoneType'>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220919/f7ae4169/attachment.htm>


More information about the QGIS-Developer mailing list