[Qgis-user] How to load a *.qgs file in a C++ QGIS standalone app?
Spartucus
niubob at hotmail.com
Mon Oct 27 17:52:18 PDT 2014
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 mapcavas
QgsMapCanvass *myMapCanvas = new QgsMapCanvas();
myMapCanvas->enableAntiAliasing(true);
myMapCanvas->setCanvasColor(Qt::white);
myMapCanvas->setVisiable(true);
//Open *.qgs project and read
QString 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!
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-load-a-qgs-file-in-a-C-QGIS-standalone-app-tp5169813.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
More information about the Qgis-user
mailing list