[Qgis-developer] Python plugin: open a project file in "append" mode

luca_manganelli at comune.trento.it luca_manganelli at comune.trento.it
Wed Aug 22 04:51:19 PDT 2012




Hi,

in the documentation, at the QgsProject entry, I read this:

bool 	read (QFileInfo const &file)
 	read project file

bool 	read ()
 	presuming that the caller has already reset the map canvas, map
registry, and legend


the first read (QFileInfo const &file) sets the project filename and calls
the second read (). As you read, it says: "presuming that the caller has
already reset the map canvas, map registry, and legend", so I wanted to use
it to append my QGIS project file to current.

But it doesn't happen: current maplayers are cleared and substituted to the
layers of the project file, althrough I still see the old project title in
the window titlebar.

Maybe it's a bug?

Here's how you can reproduce it:

write a plugin with this code:

  QgsProject.instance().read ( QFileInfo ( "<path of a qgis file>" ) )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120822/c2635e5f/attachment-0001.html>


More information about the Qgis-developer mailing list