Hello,

I want to draw only the portion of the QPainter Curved Path. I have the following code:

Qt Code:
  1. QPointF points[5];
  2. points[0] = QPoint(100, 200);
  3. points[1] = QPoint(200, 60);
  4. points[2] = QPoint(500, 180);
  5. points[3] = QPoint(600, 100);
  6.  
  7. QPainter painter(this);
  8. painter.scale(1,-1); painter.translate(0, -250);
  9. QPen pen;
  10. pen.setWidth(2);
  11.  
  12. painter.setPen(pen);
  13. float a = 1.0 / 6.0;
  14. cPath.cubicTo(p[1], -a*p[0] + p[1] + a*p[2], a*p[1] + p[2] -a*p[3], p[2]);
  15.  
  16. pen.setColor(Qt::darkRed);
  17. painter.strokePath(cPath, pen);
To copy to clipboard, switch view to plain text mode 

This draws the bezier curve just fine. But now I want to draw only to draw the portion of this whole curve, for example only the portion between points[1] and points[2].

How can I achieve this?