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

typing: fix QPolygon << operator

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • None
    • Type hints
    • None

    Description

      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

       

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes