Gurjot
11th August 2015, 12:10
Hello,
I want to draw only the portion of the QPainter Curved Path. I have the following code:
QPointF points[5];
points[0] = QPoint(100, 200);
points[1] = QPoint(200, 60);
points[2] = QPoint(500, 180);
points[3] = QPoint(600, 100);
QPainter painter(this);
painter.scale(1,-1); painter.translate(0, -250);
QPen pen;
pen.setWidth(2);
painter.setPen(pen);
float a = 1.0 / 6.0;
cPath.cubicTo(p[1], -a*p[0] + p[1] + a*p[2], a*p[1] + p[2] -a*p[3], p[2]);
pen.setColor(Qt::darkRed);
painter.strokePath(cPath, pen);
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?
I want to draw only the portion of the QPainter Curved Path. I have the following code:
QPointF points[5];
points[0] = QPoint(100, 200);
points[1] = QPoint(200, 60);
points[2] = QPoint(500, 180);
points[3] = QPoint(600, 100);
QPainter painter(this);
painter.scale(1,-1); painter.translate(0, -250);
QPen pen;
pen.setWidth(2);
painter.setPen(pen);
float a = 1.0 / 6.0;
cPath.cubicTo(p[1], -a*p[0] + p[1] + a*p[2], a*p[1] + p[2] -a*p[3], p[2]);
pen.setColor(Qt::darkRed);
painter.strokePath(cPath, pen);
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?