@@ -330,9 +330,11 @@ class _QEventLoop:
330330 If the event loop shall be used with an existing and already running QApplication
331331 it must be specified in the constructor via already_running=True
332332 In this case the user is responsible for loop cleanup with stop() and close()
333+
334+ The set_running_loop parameter is there for backwards compatibility and does nothing.
333335 """
334336
335- def __init__ (self , app = None , set_running_loop = True , already_running = False ):
337+ def __init__ (self , app = None , set_running_loop = False , already_running = False ):
336338 self .__app = app or QApplication .instance ()
337339 assert self .__app is not None , "No QApplication has been instantiated"
338340 self .__is_running = False
@@ -350,9 +352,6 @@ def __init__(self, app=None, set_running_loop=True, already_running=False):
350352 assert self .__app is not None
351353 super ().__init__ ()
352354
353- if set_running_loop :
354- asyncio .events ._set_running_loop (self )
355-
356355 # We have to set __is_running to True after calling
357356 # super().__init__() because of a bug in BaseEventLoop.
358357 if already_running :
@@ -363,6 +362,9 @@ def __init__(self, app=None, set_running_loop=True, already_running=False):
363362 self ._before_run_forever ()
364363 self .__app .aboutToQuit .connect (self ._after_run_forever )
365364
365+ # for asyncio to recognize the already running loop
366+ asyncio .events ._set_running_loop (self )
367+
366368 def run_forever (self ):
367369 """Run eventloop forever."""
368370
0 commit comments