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

uic does not generate enumeration name into enum values causing type checking warnings

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4: Low
    • 6.8.0
    • 6.6.0, 6.7.0
    • Tooling, Type hints
    • None
    • Windows 11 v22621
      Python 3.12.0
      PySide6 6.6.0
    • Windows
    • 19020092f (dev), 9acc2df00 (dev), d7ebe9178 (dev), 091487d67 (6.6), 69487198e (6.6), a9fce8fef (tqtc/lts-6.5), cf89de421 (tqtc/lts-6.5), cea33d738 (dev), effe9bd02 (dev), 2e8279602 (dev), a52c1be27 (dev), 2ee11d3e0 (6.6), c3280b616 (tqtc/lts-6.5)

    Description

      When I use any of these like these, I get type hint error (obviously not on runtime).  

       

      Qt.PointingHandCursor
      QSizePolicy.Expanding
      QIcon.Normal
      QFrame.StyledPanel
      # e.t.c  

       

      • Screenshots are in attachment section.
      • Obviously, there is no error on runtime, but my workspace is flooded with these useless warnings.

       

      What I did:

      • On inspection I found out that it arises because, for example, PointingHandCursor is inside class CursorShape, which is again inside class Qt.
      • So basically, if I use Qt.CursorShape.PointingHandCursor, I do not get any error warning for type hint.
      • So, I changed almost all my codebase for my PySide6 app to adapt to this.

      My Issue:

      • When I generate python .py files from Qt-Designer .ui files using either designer itself or using pyside uic command prompt: Generated .py files uses the older method, i.e they use Qt.PointingHandCursor instead of Qt.CursorShape.PointingHandCursor.
      • This itself has flood my workspace with nearly 500 type hint error warnings.
      • It makes harder to diagnose the problem, if some error arises out of the blue.

      My Suggestion:

      • Either make the changes in UIC to generate the python .py files with newer style. Or,
      • Or add support for older type hints style along with the newer style.

       

      Attachments

        Issue Links

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

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              ectoruseff Ecto Ruseff
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: