[Qgis-developer] Load Project file from plugin

Tim Sutton lists at linfiniti.com
Mon Nov 19 12:09:07 PST 2012


Hi


On Mon, Nov 19, 2012 at 6:31 PM, Etienne Tourigny
<etourigny.dev at gmail.com> wrote:
>
> To load a project file call QgisInterface::actionOpenProject()


Or programmatically open the project file like this:

        QgsProject.instance().setFileName(myProjectPath)
        QgsProject.instance().read()

Regards

Tim


>
>
> most app-related stuff that a plugin can do are in the QgisInterface class
>
> On a related note:
> If you want the plugin to do something when a project file is loaded,
> you need to connect to the QGisInterface projectRead() signal
>
> http://www.qgis.org/api/classQgisInterface.html#af740dfa32487613224a249c8f5c2111b
>
> This will ensure that when a project is loaded your code will get called.
>
>
>
> On Mon, Nov 19, 2012 at 2:12 PM, Justin Hubbard
> <justin at pyrotechsoftware.com> wrote:
> > Hi
> >
> > I must be missing something... I have searched the API and the web, but
> > cannot find out how to do this seemingly simple task
> >
> > I want to make my plugin automatically load a specified .qgs Project file
> > into QGIS when the plugin is activated.
> >
> > I'm sure that I must be missing something.
> > Any help appreciated
> >
> > Thanks
> > Justin
> >
> > _______________________________________________
> > Qgis-developer mailing list
> > Qgis-developer at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer




--
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================


More information about the Qgis-developer mailing list