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

Documentation wrong concerning calls with output parameters

    XMLWordPrintable

Details

    • All
    • 7a24a59db (dev), 22d1beb74 (dev), c781403e5 (6.5), f441778f0 (6.5)

    Description

      The documentation for the QPainter.drawText function has this text:

      The boundingRect (if not null) is set to the what the bounding rectangle should be in order to enclose the whole text. For example, in the following image, the dotted line represents boundingRect as calculated by the function, and the dashed line represents rectangle:

      This appears to be copied directly from the C++ documentation, and the code sample given is a direct translation of the C++ code sample to Python.

      In fact, this API does not accept boundingRect as an output parameter (and in fact Python best practice doesn't include using output parameters). Instead, it returns a QRect. The documentation says that the return value is None, including documentation within the module itself (accessible via Python help()).

      The same is true of every overload of drawText on that page, and may well be true for other functions that take output parameters in C++.

      https://doc.qt.io/qtforpython-6/PySide6/QtGui/QPainter.html#PySide6.QtGui.PySide6.QtGui.QPainter.drawText

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            tomdhunt Tom Hunt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes