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

bug in QPainter::drawline() using raster engine

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • 4.8.x
    • 4.6.2
    • GUI: Painting
    • None
    • windows 7

    Description

      When I draw line with a QPainter (using raster engine, with a cosmetic pen) to which I set a world transform matrix, it will sometimes display a wrong image. This will mostly happen when I draw a line whose start point is equal to its end point. But I have also watched this problem when I draw a vertical line, but this is a very rare case.
      the following code can produce this problem:

      QPainter painter(this);

      QTransform t(
      100000, -0, 0,
      0, -100000, 0,
      -44271.3, 46459.2, 1);

      painter.setWorldTransform(t);
      painter.setRenderHint(QPainter::Antialiasing, true);

      painter.setPen(Qt::magenta);

      QPointF p(0.44375, 0.463636);
      painter.drawLine(p, p);

      you can attach the above code to your widget's paintEvent() method, and you will see your widget is filled with magenta color instead of displaying a line(actually should be a point).
      I have debug this code and found that the cosmetic pen is not respected by drawLine(), It will draw a very big (because my world transform has very big scale factor) point instead of a one pixel width point.

      Attachments

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

        Activity

          People

            firedomain Qt Graphics Team (Inactive)
            jianliang79 liang jian
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes