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

typing: fix QPolygon << operator

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Fixed
    • Icon: P3: Somewhat important P3: Somewhat important
    • 6.10.0, 6.9.3
    • None
    • Type hints
    • None
    • 841014786 (dev), df3838f7e (6.9), ea902b8c1 (tqtc/lts-6.8)

      Reported from PySide6-stubs

      QPolygon operator << has incorrect return type.

      The following should be correctly type-checked but is not:

      point = QPoint()
      point_list = [point]
      polygon = QPolygon()

      polygon << point << point
      polygon << [point, point] << [point, point] << (point, point) << (point, point)

      Current signature is:

          @typing.overload
          def _lshift(self, arg_1: PySide6.QtCore.QPoint, /) -> None: ...
          @typing.overload
          def _lshift(self, arg_1: typing.Sequence[PySide6.QtCore.QPoint], /) -> None: ...

       

      It works correctly if we change it to:

          @overload
          def _lshift(self, arg_1: PySide6.QtCore.QPoint) -> PySide6.QtGui.QPolygon: ...
          @overload
          def _lshift(self, arg_1: Sequence[PySide6.QtCore.QPoint]) -> PySide6.QtGui.QPolygon: ...

       

      Note that the same fix should be done to QPolygonF

       

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

            cinucen Ece Cinucen
            bluebird75 Philippe Fremy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes