Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. QtAsyncio handle_sigint QDockWidget Timer Issue?
Forum Updated to NodeBB v4.3 + New Features

QtAsyncio handle_sigint QDockWidget Timer Issue?

Scheduled Pinned Locked Moved Unsolved Qt for Python
pyside
1 Posts 1 Posters 110 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Michael Barth
    wrote on 10 Feb 2025, 19:41 last edited by
    #1

    I was going to start integrating asyncio into my application. If I use QtAsyncio.run(handle_sigint=True)

    I get the following output if I use Ctrl+C in the console:

    QObject::killTimer: Timers cannot be stopped from another thread
    QObject::~QObject: Timers cannot be stopped from another thread
    

    I've narrowed this down to using QDockWidget. Here is a minimally reproducible example (basically the minimal example on the docs trimmed down to just a dock widget) :

    # Copyright (C) 2022 The Qt Company Ltd.
    # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
    from __future__ import annotations
    
    from PySide6.QtWidgets import (QApplication, QMainWindow, QDockWidget)
    
    import PySide6.QtAsyncio as QtAsyncio
    import sys
    
    class MainWindow(QMainWindow):
        def __init__(self):
            super().__init__()
            widget = QDockWidget()
            self.setCentralWidget(widget)
    
    
    if __name__ == "__main__":
        app = QApplication(sys.argv)
        main_window = MainWindow()
        main_window.show()
    
        QtAsyncio.run(handle_sigint=True)
    

    Based on my understanding of asyncio, I'm not spinning up an additional thread, so I'm confused. I supposed it's possible that the SIGINT comes from another thread and there's improper handling there. I couldn't reproduce this by just creating a 1 second timer. (I didn't try very hard)

    I'm using PySide6 on Windows 11. Here's the version I have:

    python -m pip show pyside6
    Name: PySide6
    Version: 6.8.2
    Summary: Python bindings for the Qt cross-platform application and UI framework
    Home-page: https://pyside.org
    Author:
    Author-email: Qt for Python Team <pyside@qt-project.org>
    License: LGPL
    Location: C:\Users\Michael.Barth\AppData\Local\Programs\Python\Python312\Lib\site-packages
    Requires: PySide6-Addons, PySide6-Essentials, shiboken6
    Required-by:
    

    Am I misunderstanding something/doing something wrong?

    1 Reply Last reply
    0

    1/1

    10 Feb 2025, 19:41

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved