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:
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).