QPainterPath from list of points
Solved
General and Desktop
-
As mentioned above you can use QPainterPathStroker. The problem is it will create tiny loops on the inside of the joints, so you need to simplify the path afterwards.
Sample code:QVector<QPoint> points { QPoint(30,30), QPoint(100, 100), QPoint(200,50) }; QPainterPath basePath; basePath.addPolygon(QPolygon(points)); QPainterPathStroker str; str.setCapStyle(Qt::RoundCap); str.setWidth(10.0); QPainterPath resultPath = str.createStroke(basePath).simplified();
-
Wow, I am deeply impressed. Using the code shown by @Chris-Kawa gave exactly the desired result:
Thank you very much for your help, guys. Very appreciated!
-
well what can we say ?
Chris rules :) -
@mrjj Well, thanks to you and @kshegunov too. You guys are amazing!