Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-3057

typing: QTreeWidget.setItemWidget() accepts None

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.9.0, 6.8.3, 6.10.0
    • None
    • Type hints
    • None
    • 20fb997fe (dev), 37a19f5d3 (6.8), abb28b752 (dev), c245ca90c (6.9), 1e1c058c4 (6.8)

    Description

      Passing None as a widget to QTreeWidget.setItemWidget() will do what the user expects, remove the widget from the item. Just like QTreeWdiget.removeItemWidget()

      But this is not accepted by typing stubs.

       

      Example code :

       

      from typing import Optional
      from PySide6.QtWidgets import QTreeWidget, QTreeWidgetItem

      t = QTreeWidget()
      item = QTreeWidgetItem(t, ['abc'])

      # it should be possible to remove the item widget for an itemt.setItemWidget(item, 0, None)

      Not sure you should fix that one, but it was reported on PySide6-stubs.

      Similar issue reported in PYSIDE-3042 but for QListWidget

      Attachments

        Issue Links

          For Gerrit Dashboard: PYSIDE-3057
          # Subject Branch Project Status CR V

          Activity

            People

              ctismer Christian Tismer
              bluebird75 Philippe Fremy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes