[QGIS-Developer] Event woes in QGIS

Lars I. Nielsen, LIFA A/S lin at LIFA.DK
Wed Aug 21 05:15:26 PDT 2019


Hi bold developers of QGIS.

I've recently begun digging into utilizing the event (signal) model of QGIS (3.4).

And I've encountered a number of frustrations, as the events don't work the way they're supposed to, at least according to the available documentation (https://qgis.org/pyqgis/master/core/index.html).

E.g., the event "layerLoaded" on the project instance with the description "Emitted when a layer from a projects (sic) was read", which to me indicates, that the loading is done (due to the use of "loaded" and "was").

But the event is emitted before the loading of the layer is done, and you are therefore unable to find the layer it concerns.

Another example is the event "metadataChanged" on a loaded layer, which again to me indicates a past/done action (due to the use of "changed"). But again, it's emitted before the change actually takes place, and the changed metadata isn't available.

If the two events are indeed preload events, their names should instead be something like "layerLoading" and "metadataChanging", or even "layerPreLoad" and "metadataPreChange".

Is there a guide somewhere to tell how the event system is envisioned, and which events are emitted pre-action and which are emitted post-action ?

Or must I (hopefully not) take a deep look into the QGIS source code itself for this kind of information ?

In general, pre-action events are of limited use, except when it comes to deletions and destructions. For loading and changing stuff, post-action events are almost always what you need.



Med venlig hilsen

Lars I. Nielsen, LIFA A/S
GIS-konsulent, FME Certified Professional
Geoinformatik
[Beskrivelse: C:\Users\lin\AppData\Roaming\Microsoft\signatures\284x82-3741133837051347070]
T

6313 6800

@

lin at lifa.dk

D

6313 6849

W

www.lifa.dk<http://www.lifa.dk>

M

2492 4866

CVR

20937289


[Beskrivelse: C:\Users\lin\AppData\Roaming\Microsoft\signatures\21x21-3019966288736195652]<https://www.linkedin.com/company/lifa-a-s/>
Følg os på LinkedIn og læs de seneste nyheder fra LIFA A/S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190821/7c375187/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 6269 bytes
Desc: image001.gif
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190821/7c375187/attachment-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 1204 bytes
Desc: image002.png
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190821/7c375187/attachment-0001.png>


More information about the QGIS-Developer mailing list