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

QWindowsVistaStyle::drawPrimitive(PE_PanelItemViewItem) alters QPainter state

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.0.0 Beta 2
    • 4.8.2
    • GUI: Painting
    • None
    • Windows 7
    • 96ebbad5f03d6db5fa81f284ccbdaf4b6259c27b, Qt 4: c240761fd00bd4a284a261d926a27265bcc84ca9

    Description

      after a call to drawPrimitive(PE_PanelItemViewItem), the painter's brush origin is left altered.

      In 4.8.2, the offending line is line 749 of src/gui/styles/qwindowsvistastyle.cpp:

      QWindowsVistaStyle::drawPrimitive(...)
      ...
          case PE_PanelItemViewItem:
      ...
                      if (vopt->backgroundBrush.style() != Qt::NoBrush) {
                          QPointF oldBO = painter->brushOrigin();
                          painter->setBrushOrigin(vopt->rect.topLeft());
                          painter->fillRect(vopt->rect, vopt->backgroundBrush);
                      }
      

      The old brush origin is saved, but not restored. This means when my custom item delegate draws content after drawing the background panel, its gradients are corrupted by the change of brush origin.

      In Qt5, this code seems to have moved to src/widgets/styles/qwindowsvistastyle.cpp, and oldBO is gone. This changed in revision http://qt.gitorious.org/qt/qtbase/commit/abe5a0a432116963d22c4ef501a4dfd2393d66fb, but Friedemann Kleint's comment for this was just "Warnings fixes", so I think he just removed it without realizing that the warning had caught a real bug (the saved value was not restored).

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            puetzk Kevin Puetz
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes