[QGIS-Developer] How can I connect to events in a QGIS main window from a Python plugin - or: How can I trigger a function once the main window has actually been displayed?

Sebastian M. Ernst ernst at pleiszenburg.de
Tue Sep 3 05:56:30 PDT 2019


Hi Jürgen,

thanks for your help, it works.

It poses another closely related question: The `initializationCompleted`
signal is only emitted once. If the plugin is loaded together with QGIS,
this is fine. However, if it is loaded later, maybe because it is
installed by a user from within a running QGIS process, the plugin does
not receive this signal. QGIS must be restarted for the plugin to work.
Is there a way to figure out whether this signal has already been
emitted in the past (for the current QGIS process) / the initialization
has been completed?

Sebastian


Am 17.08.19 um 12:17 schrieb Jürgen E. Fischer:
> Hi Sebastian,
> 
> On Sat, 17. Aug 2019 at 11:25:59 +0200, Sebastian M. Ernst wrote:
>> in a QGIS Python plugin, I want to run a function (a single time) when
>> the QGIS main window has actually been displayed / fully loaded.
> 
> iface has a signal initializationCompleted, that you connect in initGui.
> 
> 
> Jürgen
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190903/b365ce04/attachment.sig>


More information about the QGIS-Developer mailing list