# The Maximum Number of Control Points to Draw a Bezier Curve with QPainterPath

• Hi all,

I've drawn the bezier curve by using QPainterPath as following. The initial control point (C0, start point) is set with the function moveTo. The control points C1, C2 and the last control point (C4, end point) are set with the function cubicTo. Is the maximum number of control points is 4 to create bezier curve with QPainterPath? If not, could you please explain how to draw a bezier curve with 6 control points?

@
QPainterPath mCurrentPath;
mCurrentPath.moveTo(5, 5);
mCurrentPath.cubicTo(40, 10, 50, 50, 199, 199);
@

Thanks a lot for your explanations and helps,

Yasemin

• I want to learn the Qt's limitations related to bezier curves. I suppose QtSDK does not include a function to draw higher-degree (>4) bezier curves, doesn't it?

• Have you tried to "compose":https://qt-project.org/doc/qt-4.8/qpainterpath.html#composing-a-qpainterpath different painter paths ? This way you could construct bezier splines with a higher degree.

For example you could first draw a spline using the first 4 points (A,B,C,D) then draw a second spline using points B,C,D,E and so on. Depending on the combination of points you use to compose the splines you get different results.

I guess you're familiar with the "theoretics":http://en.wikipedia.org/wiki/Bézier_curve for splines?

• Hi KA51O,

Thanks a lot for your help,

I've tried to compose the different painter paths for example fifth degree bezier curve (five control points). But the result is the composition of several curves. Whereas I've expected only one curve composing of five control points. I've read the wiki article but I can't figure out how to draw higher degree bezier curves by using QPainterPath.

Can QPainterPath succeed it? Otherwise should I try external library (Qwt) or write myself? I will be so glad if you can explain.

@
QPainterPath mPath;
mCurrentPath.moveTo(Q_NODE_POINT(0));
mCurrentPath.cubicTo(Q_NODE_POINT(1), Q_NODE_POINT(2), Q_NODE_POINT(3));
mPath.moveTo(Q_NODE_POINT(1));
mPath.cubicTo(Q_NODE_POINT(2), Q_NODE_POINT(3), Q_NODE_POINT(4));
mCurrentPath.connectPath(mPath);