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

QPainter on QBitmap: drawRect with NoBrush still fills the rectangle

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 4.8.6, 5.3.0 Beta1
    • GUI: Painting
    • None

    Description

      Surely this code:

      painter.setBrush(Qt::NoBrush);
      painter.drawRect(0, 0, 99, 99);

      isn't supposed to fill the rectangle. But it does, when drawing on a QBitmap.

      Regression compared to Qt 3.3, present in both Qt 4.8 and Qt 5.3.

      Testcase attached. The drawRect hides the lines that were previously drawn, on the right side (drawing on bitmap).

      I tried to debug it, and s->brushData.blend is not null because
      qpaintengine_raster_p.h's ensureBrush() says brush.style() != Qt::NoBrush && state()->fillFlags, i.e. it ignores the dirty flags when the style is NoBrush.

      So the old brush remains (and for a bitmap, the default brush is QBrush(Qt::color0), for no good reason, see QTBUG-5443 / qpainter.cpp:1849 in Qt 4.8. I guess it's too late to change that, though)

      Attachments

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

        Activity

          People

            sletta Gunnar Sletta
            dfaure David Faure (Private)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes