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

__doc__ returns None from Qt subclass

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.6.0
    • 6.2.4
    • PySide
    • None
    • All
    • 3a95cdec2 (dev), cc2e48d09 (6.5)

    Description

      If you subclass a Qt class, for example QObject, the __doc__ returns None, that doesn't happen if the instance is used. The sphinx uses FooClass.__doc__ to access the class documentation so in general the documentation is problematic.

      from PyQt6.QtCore import QObject as PyQt6QObject
      from PySide6.QtCore import QObject as PySide6QObject
      
      
      class Foo:
          """Foo docs"""
      
      
      class PyQt6Foo(PyQt6QObject):
          """PyQt6Foo docs"""
      
      
      class PySide6Foo(PySide6QObject):
          """PySide6Foo docs"""
      
      
      print("* From class:")
      print("Foo:", Foo.__doc__)
      print("PyQt6QObject:", PyQt6QObject.__doc__)
      print("PySide6QObject:", PySide6QObject.__doc__)
      print("PyQt6Foo:", PyQt6Foo.__doc__)
      print("PySide6Foo:", PySide6Foo.__doc__)
      print("* From instance:")
      print("Foo:", Foo().__doc__)
      print("PyQt6Foo:", PyQt6Foo().__doc__)
      print("PySide6Foo:", PySide6Foo().__doc__)
      

      Output:

      * From class:
      Foo: Foo docs
      PyQt6QObject: QObject(parent: QObject = None)
      PySide6QObject: QObject(self, parent: Optional[PySide6.QtCore.QObject] = None) -> None
      PyQt6Foo: PyQt6Foo docs
      PySide6Foo: None
      * From instance:
      Foo: Foo docs
      PyQt6Foo: PyQt6Foo docs
      PySide6Foo: PySide6Foo docs
      

      Attachments

        1. pyside1884.py
          0.6 kB
          Friedemann Kleint

        Issue Links

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

          Activity

            People

              ctismer Christian Tismer
              eyllanesc Edwin Christian Yllanes Cucho
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes