Re: [Qgis-developer] Open a *.qgs project file in API, why maps do not show?
Hi Gary, According to the QgisApp::addProject( QString projectFile ) function, I did some change in my code. However, the map still doesn't show, but the CRS in project works fine. So I think the project file was read but there is something wrong about display(or MapCanvas). I don't use Python plug-ins and ScaleComboBox, so I remove the relevant part, the code is: -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Open-a-qgs-project-file-in-API-why-maps-do-not-show-tp5168545p5168673.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Open a *.qgs project file in API, why maps do not show?
On 10/20/14 6:10 PM, Tendfly niu wrote: Hi all, I'm using QGIS-2.4.0 API. I saved a test.qgs file in QGIS Desktop, in this project, there is one layer in it. Then I open the test.qgs project file in QGIS API to developing, but it is not showed in APP. Why is that? The code I'm using to open the project is: QString myProjectPath = E:\\QGIS\\Pro\\test.qgs; Qgsproject::instance()-setFileName(myProjectPath); bool isRead = QgsProject::instance()-read(); In Debug mode, isRead equals TRUE. Use: iface.addProject(myProjectPath) Any advice would be appreciated! Regards, Bob ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-= Gary Sherman Founder, QGIS Project Consulting: geoapt.com Publishing: locatepress.com We work virtually anywhere =-=-=-=-=-=-=-=-=-=-=-=-=-=-= ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Open a *.qgs project file in API, why maps do not show?
Hi Gary , Thanks for reply! I don't what iface is. Is it another name of QgsProject::instance()? I'm using C++ to developing app. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Open-a-qgs-project-file-in-API-why-maps-do-not-show-tp5168545p5168547.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Open a *.qgs project file in API, why maps do not show?
On 10/20/14 6:24 PM, Spartucus wrote: Hi Gary , Thanks for reply! I don't what iface is. Is it another name of QgsProject::instance()? I'm using C++ to developing app. Ah, I missed the fact you were using C++. iface is an instance of QgisInterface available in the Python console. It exposes interfaces in QgisApp, which doesn't help you if you are developing a standalone app in C++. See the code for: QgisApp::addProject( QString projectFile ) in qgisapp.cpp for how QGIS loads a project file. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Open-a-qgs-project-file-in-API-why-maps-do-not-show-tp5168545p5168547.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-= Gary Sherman Founder, QGIS Project Consulting: geoapt.com Publishing: locatepress.com We work virtually anywhere =-=-=-=-=-=-=-=-=-=-=-=-=-=-= ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Open a *.qgs project file in API, why maps do not show?
Thanks a lot! I will try that. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Open-a-qgs-project-file-in-API-why-maps-do-not-show-tp5168545p5168549.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer