@@ -330,9 +330,11 @@ class _QEventLoop:
330
330
If the event loop shall be used with an existing and already running QApplication
331
331
it must be specified in the constructor via already_running=True
332
332
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.
333
335
"""
334
336
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 ):
336
338
self .__app = app or QApplication .instance ()
337
339
assert self .__app is not None , "No QApplication has been instantiated"
338
340
self .__is_running = False
@@ -350,9 +352,6 @@ def __init__(self, app=None, set_running_loop=True, already_running=False):
350
352
assert self .__app is not None
351
353
super ().__init__ ()
352
354
353
- if set_running_loop :
354
- asyncio .events ._set_running_loop (self )
355
-
356
355
# We have to set __is_running to True after calling
357
356
# super().__init__() because of a bug in BaseEventLoop.
358
357
if already_running :
@@ -363,6 +362,9 @@ def __init__(self, app=None, set_running_loop=True, already_running=False):
363
362
self ._before_run_forever ()
364
363
self .__app .aboutToQuit .connect (self ._after_run_forever )
365
364
365
+ # for asyncio to recognize the already running loop
366
+ asyncio .events ._set_running_loop (self )
367
+
366
368
def run_forever (self ):
367
369
"""Run eventloop forever."""
368
370
0 commit comments