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

[Type Hints] Typing of properties for QStyleOption classes are broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.5.3
    • Type hints
    • None
    • All

      It seems as if all properties of classes derived from QStyleOption are broken. Give the following example code:

       

      from PySide6.QtCore import QRectF
      from PySide6.QtWidgets import QStyleOptionGraphicsItem
      option = QStyleOptionGraphicsItem()
      option.exposedRect = QRectF(0, 0, 10, 10)
      

      Mypy will fail with the following error:

      error: "QStyleOptionGraphicsItem" has no attribute "exposedRect"  [attr-defined]

      Nevertheless, the property is valid: https://doc.qt.io/qt-6/qstyleoptiongraphicsitem.html#exposedRect-var

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

            ctismer Christian Tismer
            tilmankrummeck Tilman Krummeck
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes