[QGIS-Developer] Catch qgis exit

Ujaval Gandhi ujaval at spatialthoughts.com
Thu Jun 25 08:24:54 PDT 2020


I saw that there is a aboutToQuit signal emitted just before a QApplication
exists. The following works from QGIS Python Console.

def test():
    with open('/tmp/test.txt', 'w') as f:
        f.write('wrote while exiting')

qApp.aboutToQuit.connect(test)
[image: Logo] <https://spatialthoughts.com/>
Ujaval Gandhi
Spatial Thoughts
mobile: +91-8095684687
email: ujaval at spatialthoughts.com
[image: LinkedIn icon] <https://www.linkedin.com/in/spatialthoughts/>  [image:
Twitter icon] <https://twitter.com/spatialthoughts>
Subscribe to our newsletter http://bit.ly/spatialthoughts-newsletter


On Thu, Jun 25, 2020 at 5:00 PM Jan Růžička <jan.ruzicka.vsb at gmail.com>
wrote:

> Dear developers,
>
> I have developed a plugin for the Police of the Czech Republic for Search
> and Rescue operations. It works quite well, but one important feature is
> missing.
>
> After the search event is finished the user should enter the result of the
> search.
>
> I was not able to find a way to catch an event when the user closes the
> whole QGIS. I need similar functionality like when closing in the case of a
> dirty project (no all changes were saved).
>
> I have searched a lot and did not find any solution. I was able to catch
> the unload event of the plugin, but I did not find a way to keep QGIS
> opened.
>
> Any help appreciated
> Jan Růžička, Ph.D.
> freelancer, researcher and volontaire
> Geoinformatics
> tel: +420 775 032 091
> e-mail: jan.ruzicka.vsb at gmail.com <http://jan.ruzicka.vsb.cz/>
> http://github.com/ruz76/
> http://gismentors.eu/
> http://dolnilhota.info/
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200625/46ff1b8e/attachment.html>


More information about the QGIS-Developer mailing list