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

QtWidgets.pyi: Improving type annotations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.9.1, 6.10.0
    • 6.x, 6.8.2
    • Type hints
    • None
    • All
    • f261c2ed7 (dev), 351372d3d (6.9), 575fb1bb3 (6.8)

    Description

      I have now started fixing type annotations in the QtWidgets.pyi stub file.

      Types with a * appended are changed to have no such symbol in comments which list signal types (because Python does not have pointers) and :: are changed to . because Python uses the dot notation. I have also changed signal types listed in such comments so that QString types are str and double types are float.

      Also, explicitly inheriting from object, which some classes do, is removed, since this is redundant.

      Besides this, I have imported types from where it is recommended to do so, hence I imported the Sequence type from collections.abc, rather than from typing which is deprecated, and I have done the same for Callable.

      What I did as well was annotating the parent parameters of about, aboutQt, critical, information, question, and warning static methods of the QMessageBox class as QWidget | None as oppose to having the current QWidget annotation, because passing None is perfectly valid and should be annotated as such.

      Here's the file: QtWidgets.pyi

      Attachments

        1. QtWidgets.pyi
          590 kB
          Boštjan Mejak
        For Gerrit Dashboard: PYSIDE-3021
        # Subject Branch Project Status CR V

        Activity

          People

            ctismer Christian Tismer
            pedantichacker Boštjan Mejak
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes