Hi,
I need to create an outline following a curve with a fixed width (said 100), as shown in my attachment 1.
To do this, I use QPainterPathStroker using following code. However, the resulting stroker joins them with the curve (see attachment 2). What I want is the outline without joining with the curve. How can I do so? Thanks!
QVector<QPointF> myCurve; // <-- myCurve is calculated somewhere else.
curvePath.moveTo( myCurve[ 0 ] );
for ( int idx = 1; idx < myCurve.size(); idx++ ) {
curvePath.lineTo( myCurve[ idx ] );
}
stroker.setCapStyle( Qt::RoundCap );
stroker.setJoinStyle( Qt::RoundJoin );
stroker.setWidth( 100 );
painter->drawPath( outline );
QVector<QPointF> myCurve; // <-- myCurve is calculated somewhere else.
QPainterPath curvePath;
curvePath.moveTo( myCurve[ 0 ] );
for ( int idx = 1; idx < myCurve.size(); idx++ ) {
curvePath.lineTo( myCurve[ idx ] );
}
QPainterPathStroker stroker;
stroker.setCapStyle( Qt::RoundCap );
stroker.setJoinStyle( Qt::RoundJoin );
stroker.setWidth( 100 );
QPainterPath outline = stroker.createStroke ( curvePath );
painter->drawPath( outline );
To copy to clipboard, switch view to plain text mode
Bookmarks