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

Reg->6.2.2/MyPy: Type of Qt.AlignmentFlag incompatible with Qt.Alignment

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.3
    • 6.2.2
    • PySide, Shiboken
    • None
    • All
    • 3bd132cbaf (pyside/pyside-setup/dev) cc09c222ee (pyside/pyside-setup/6.3) cc09c222ee (pyside/pyside-setup/wip/6.3_pypy) cc09c222ee (pyside/tqtc-pyside-setup/6.3)

    Description

      Qt.AlignmentFlag can't be used as argument to functions expecting Qt.Alignment since PySide6 6.2.2.

      Using this code which was typed correctly on 6.2.1:

      detailslayout = QHBoxLayout()
      detailslayout.setAlignment(Qt.AlignLeft)
      

      is now reporting type violations:

      error: No overload variant of "setAlignment" of "QLayout" matches argument type "AlignmentFlag"
      

      Furthermore Qt.AlignmentFlag is not composable anymore:

      Qt.AlignLeft | Qt.AlignVCenter
      

      reports

      error: Unsupported left operand type for | ("AlignmentFlag")
      

      The relevant change in QtCore.pyb seems to be the move from Shiboken.Enum to Enum for class AlignmentFlag:

      # 6.2.1
      class AlignmentFlag(Shiboken.Enum):
          AlignLeading             : Qt.AlignmentFlag = ... # 0x1
          AlignLeft                : Qt.AlignmentFlag = ... # 0x1
      
      # 6.2.2
      class AlignmentFlag(Enum):
          AlignLeading             : Qt.AlignmentFlag = ... # 0x1
          AlignLeft                : Qt.AlignmentFlag = ... # 0x1
      

      Attachments

        1. pyside1731_6_nonrepro.py
          1 kB
        2. pyside1731_nonrepro.py
          1 kB
        3. pyside1731.jpg
          pyside1731.jpg
          17 kB
        4. type-errors.png
          type-errors.png
          69 kB

        Issue Links

          For Gerrit Dashboard: PYSIDE-1731
          # Subject Branch Project Status CR V

          Activity

            People

              ctismer Christian Tismer
              systemcluster Christian Sdunek
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes