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. pyside6-designer custom widget already deleted issue
Forum Update on Tuesday, May 27th 2025

pyside6-designer custom widget already deleted issue

Scheduled Pinned Locked Moved Unsolved Qt for Python
qt for python
1 Posts 1 Posters 571 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.
  • O Offline
    O Offline
    Okko Willeboordse
    wrote on 5 Feb 2023, 19:17 last edited by
    #1

    Running: Python 3.11.1, PySide6==6.4.2 on Windows 11.

    Given the following custom widget;

    class MyWidget(PySide6.QtWidgets.QCheckBox):
    
        def _update_screen(self, screen):
            pass
    
        def showEvent(self, event):
            window = self.window().windowHandle()
            window.screenChanged.connect(self._update_screen)
    

    This widget runs fine when used in an application.

    However when this widget is deployed as a custom widget in pyside6-designer and dragged onto a UI, pyside6-designer runs into an exception which is shown when pyside6-designer is stopped;

    Error: Traceback (most recent call last):
      File "C:\Temp\designer_issue\widget.py", line 12, in showEvent
        window.screenChanged.connect(self._update_screen)
    RuntimeError: Internal C++ object (PySide6.QtGui.QWindow) already deleted.
    
    while executing 'C:\Temp\designer_issue\.venv\Lib\site-packages\PySide6\designer'
    

    The self.window() is;

    <PySide6.QtWidgets.QMainWindow(0x1f873cc70a0, name="MDIWindow") at 0x000001F8748946C0>
    

    and the apparently deleted self.window().windowHandle() is;

    <PySide6.QtGui.QWindow(0x1f873f47020, name="MDIWindowWindow") at 0x000001F874894740>
    

    Do I need to check if the Internal C++ object is deleted and how do I do this?

    As to the origin of the Widget code, see;

    matplotlib.backends.backend_qt.FigureCanvasQT
    
    1 Reply Last reply
    1

    1/1

    5 Feb 2023, 19:17

    • 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