I'm using QGIS-2.4.0 API to develop a standalone app by C++.
I saved a test.qgs file in QGIS Desktop software, in the project, there was one layer and it was visible.
Then I loaded the test.qgs project file in app, but there is nothing showed.
Why is that?
The code I'm using to open the project is:
QgsApplication app(argc, argv, true);QString myQgisDir = "C:\\Program Files(x86)\\qgis2.4.0";app.setPrefixPath(myQgisDir, true);app.initQgis();//The set of mapcavasQgsMapCanvass *myMapCanvas = new QgsMapCanvas();myMapCanvas->enableAntiAliasing(true);myMapCanvas->setCanvasColor(Qt::white);myMapCanvas->setVisiable(true);//Open *.qgs project and readQString myProjectPath = "E:\\QGIS\\Pro\\test.qgs"; Qgsproject::instance()->setFileName(myProjectPath); bool isRead = QgsProject::instance()->read(); //In Debug mode, isRead equals TRUE.Can somebody help me out? Any advice would be appreciated!
أكثر...
I saved a test.qgs file in QGIS Desktop software, in the project, there was one layer and it was visible.
Then I loaded the test.qgs project file in app, but there is nothing showed.
Why is that?
The code I'm using to open the project is:
QgsApplication app(argc, argv, true);QString myQgisDir = "C:\\Program Files(x86)\\qgis2.4.0";app.setPrefixPath(myQgisDir, true);app.initQgis();//The set of mapcavasQgsMapCanvass *myMapCanvas = new QgsMapCanvas();myMapCanvas->enableAntiAliasing(true);myMapCanvas->setCanvasColor(Qt::white);myMapCanvas->setVisiable(true);//Open *.qgs project and readQString myProjectPath = "E:\\QGIS\\Pro\\test.qgs"; Qgsproject::instance()->setFileName(myProjectPath); bool isRead = QgsProject::instance()->read(); //In Debug mode, isRead equals TRUE.Can somebody help me out? Any advice would be appreciated!
أكثر...