Qt QPainterPath和cubicTo,线条平滑

Qt QPainterPath和cubicTo,线条平滑,qt,qt4,qpainter,Qt,Qt4,Qpainter,我试图用平滑的线连接点,如图所示 如何获得如图所示的平滑线条 QPainterPath myPath(A); myPath.cubicTo(A,A,B); myPaht.cubicTo(B,B,C); myPath.cubicTo(C,C,D); myPainter.drawPath(myPath); 图:-我写了这段代码,得到了类似的结果 QPainterPath myPath(QPointF(50,50));//start point myPath.cubicTo(60,25,80,80,

我试图用平滑的线连接点,如图所示

如何获得如图所示的平滑线条

QPainterPath myPath(A);
myPath.cubicTo(A,A,B);
myPaht.cubicTo(B,B,C);
myPath.cubicTo(C,C,D);
myPainter.drawPath(myPath);

图:-

我写了这段代码,得到了类似的结果

QPainterPath myPath(QPointF(50,50));//start point
myPath.cubicTo(60,25,80,80,90,60);  //set another points

scene->addPath(myPath,QPen(Qt::red));//I use graphicsscene, but you can use, what you want
ui->graphicsView->setScene(scene);
ui->graphicsView->show();

谢谢你的回复。如何为超过4个点绘制类似的平滑路径?大约100分。使用两个QPainterPath.cubicTo(从上一个端点开始的下一个)不会创建平滑线。关于为所附图像中的黑匣子创建剪切矩形/区域有何评论?