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

Missing import NoneType in QtWidgets.pyi

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4: Low
    • 6.5.0, 6.6.0
    • 6.4.3
    • PySide
    • None
    • afe276ae9 (dev), 90ef530f9 (6.5), 15b964d00 (dev), 165232a09 (6.5), 1ae272c38 (dev), f32c87d71 (6.7), 2d18d70ea (tqtc/lts-6.5)

    Description

      The NoneType in QtWidgets.pyi cannot be resolved by type checker like pyright

      Example:

      action_testme = QtGui.QAction("TestMe", self)
      menu.addAction(action_testme)
      

      Type check error is:

      Type of "addAction" is partially unknown
        Type of "addAction" is "Overload[(action: QAction) -> None, (arg__1: QIcon | QPixmap, text: str, arg__3: object, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int | Unknown = ...) -> None, (icon: QIcon | QPixmap, text: str) -> QAction, (icon: QIcon | QPixmap, text: str, callable: object) -> QAction, (icon: QIcon | QPixmap, text: str, receiver: QObject, member: bytes, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int) -> QAction, (icon: QIcon | QPixmap, text: str, receiver: QObject, member: bytes, type: ConnectionType = ...) -> QAction, (icon: QIcon | QPixmap, text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int) -> QAction, (icon: QIcon | QPixmap, text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int, callable: object) -> QAction, (icon: QIcon | QPixmap, text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int, receiver: QObject, member: bytes, type: ConnectionType = ...) -> QAction, (text: str) -> QAction, (text: str, arg__2: object, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int | Unknown = ...) -> None, (text: str, callable: object) -> QAction, (text: str, receiver: QObject, member: bytes, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int) -> QAction, (text: str, receiver: QObject, member: bytes, type: ConnectionType = ...) -> QAction, (text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int) -> QAction, (text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int, callable: object) -> QAction, (text: str, shortcut: QKeySequence | QKeyCombination | StandardKey | str | int, receiver: QObject, member: bytes, type: ConnectionType = ...) -> QAction]"
      

      This can be fixed by adding this import to QtWidgets.pyi

      from types import NoneType
      

       

      Attachments

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              rems Rémy Cocole
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes