Uwe, thanks so much for that fix. I took a look at what you did (in the SVN Qwt 6.1 development head). In method QwtPlotCurve::drawSteps(), you're using a slightly enlarged copy of the canvasRect parameter for the clipping rectangle.

I see that QwtPlotCurve::drawSteps() is virtual, and we are, in fact, already using our own subclass of QwtPlotCurve. Even though the provided canvasRect is also used for something else (i.e. also when calling fillCurve()), we are getting the desired results by OVERRIDING the drawSteps method in order to provided a (conditionally) expanded copy of canvasRect. The code below is doing that only for the current and older versions of Qwt, and only when polygon clipping is enabled.

Uwe, does it make sense that the slightly expanded copy of canvasRect is not actually causing a problem for the call to fillCurve()? ... i.e. within the actual QwtPlotCurve::drawSteps() implementation.

Qt Code:
  1. // virtual from QwtPlotCurve
  2. void SlotCurve::drawSteps (QPainter *painter,
  3. const QwtScaleMap &xMap, const QwtScaleMap &yMap,
  4. const QRectF &canvasRect, int from, int to) const
  5. {
  6. //---------------------------------------------------------------------
  7. // Fixup to QwtPlotCurve bug which will be fixed after Qwt 6.1.3.
  8. // See QtCentre/Qwt Thread: http://www.qtcentre.org/threads/66464
  9. // "QwtPlotCurve Step CurveStyle incorrect when extending beyond
  10. // QwtPlot edge". [July 2016].
  11. //
  12. // If required, adjust the canvasRect to be larger, on all four sides,
  13. // by the thickness of the drawn curve (i.e. the QPainter QPen width).
  14. //---------------------------------------------------------------------
  15.  
  16. // Note: QWT_VERSION is (major << 16) + (minor << 8) + patch.
  17. const bool versNeedsCanvasRectExpand = (QWT_VERSION <= 0x060103);
  18. const bool clipOn = testPaintAttribute (QwtPlotCurve::ClipPolygons);
  19.  
  20. QRectF adjustedCanvasRect (canvasRect);
  21. if (versNeedsCanvasRectExpand && clipOn)
  22. {
  23. qreal pw = qMax (qreal(1.0), painter->pen().widthF());
  24. adjustedCanvasRect = canvasRect.adjusted (-pw, -pw, pw, pw);
  25. }
  26.  
  27. // Call the Qwt base class method
  28. QwtPlotCurve::drawSteps (painter, xMap, yMap,
  29. adjustedCanvasRect, from, to);
  30. }
To copy to clipboard, switch view to plain text mode