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.
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to