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

typing: QTreeWidget.setItemWidget() accepts None

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Fixed
    • Icon: P3: Somewhat important 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)

      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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes