[QGIS-Developer] Bridging FreeCAD and QGIS

Nyall Dawson nyall.dawson at gmail.com
Thu May 18 16:49:51 PDT 2017

On 12 May 2017 at 07:34, Luigi Pirelli <luipir at gmail.com> wrote:
> FYI in freeCAD list
> https://forum.freecadweb.org/viewtopic.php?t=22390

This is quite encouraging to read. I'd love to see stronger links
between our projects. I suspect there's a lot we can share - even if
it's just sharing all the custom widgets both projects have had to

On this note, we spoke at the Australian hackfest about how we can
make QGIS play nicer with other projects. We've got the issue right
now that QgsApplication is a QApplication, so it's currently
impossible to import the qgis libraries into another Qt project
without creating this forced Q(gs)Application.

This should change - so we came up with the idea of splitting up the
current QgsApplication class, into:

- QgsCore. A singleton (yep!) containing all the various other "single
instance members" which are currently attached to QgsApplication. E.g.
task manager, provider registries, etc. This approach was recently
taken with the construction of a QgsGui singleton containing global
GUI members.
- Move all the various path handling code out to their own class.
- Create a QApplication in main, instead of creating a QgsApplication.
Standalone scripts would need to do the same - construct their own
Q(Core/Gui)Application, just like standalone PyQt scripts require.
- Kill the need to manually call initQgis, by handling this
automatically when the qgis python libraries are imported.

Benefits would be:
- much easier use of qgis python libraries in standalone scripts
(especially with Nathan's great work in
https://github.com/qgis/QGIS/commit/df679a2). On Windows this would
then be as simple as: setup python path correctly - import qgis.core -
- QGIS libraries can be used safely with any other Qt based code which
handles its own Q(Core/Gui)Application creation.

Of course... this was just planning ahead... I don't think anyone's
actively working on this yet ;)


More information about the QGIS-Developer mailing list