[Qgis-developer] QGIS add *.qgs project file
怡帆思舟
342001728 at qq.com
Sun Mar 16 19:51:09 PDT 2014
I used 1.8.o version, when I add *.qgs file, the result is 'true', but the layercount is 0. The detail code is like this:
QString fullPath1="D:/ProgramTest/vMap/data/newProject.qgs";
mpMapCanvas->freeze( true );
QgsMapLayerRegistry::instance()->removeAllMapLayers();
QgsProject::instance()->setFileName( fullPath1 );
bool result=QgsProject::instance()->read();
mpMapCanvas->freeze( false );
mpMapCanvas->refresh();
int t=mpMapCanvas->layerCount();
QList<QgsMapLayer*>layers=mpMapCanvas->layers();
I don't know what's wrong with it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140317/2692b7ef/attachment.html>
More information about the Qgis-developer
mailing list