Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-31623

Qt5 QPainter::drawLine - aliased painting rules do not match available documentation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.0.1, 5.0.2
    • None
    • Windows XP SP3, MS Visual Studio 2010

    Description

      drawLine results with single-pixel solid pen with no antialiasing do not always follow what is described here:
      http://qt-project.org/doc/qt-5.0/qtgui/coordsys.html

      Namely, the following example from the docs is broken (does not match the picture):

      QPainter painter(this);
      painter.setPen(Qt::darkGreen);
      painter.drawLine(2, 7, 6, 1);

      All similar painting (diagonals lines with opposing X and Y directions) seem to be broken as well. Line end pixels do not follow the bottom-right pixel rule, but are off by 1 pixel (offset directions differ).

      For example, I fail to draw a symmetric X with the following code:

      painter.drawLine(10, 30, 30, 50); // good
      painter.drawLine(10, 50, 30, 30); // bad: end pixels are (10,49) and (30,29)

      Another example here:
      http://stackoverflow.com/questions/16990326/qt5-qpainter-aliased-drawing-rules

      Using Qt4CompatiblePainting solves all these issues, but I still believe that this mismatch needs to be either fixed or properly documented. I would personally prefer a fix, because I don't really see how different endpoint rules for different line directions are "sane and consistent", as the Qt5 behavior changes were described elsewhere).

      Attachments

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

        Activity

          People

            docteam Qt Documentation Team
            kirinyale Andrey Antsut
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes