PDA

View Full Version : QPainterPath line to curve



sujan.dasmahapatra
21st November 2013, 10:59
I have drawn a straight line using QPainterPath.


QPainter painter(this);
QPainterPath path;
path.moveTo(QPointF(B_Point));
path.lineTo(QPointF(D_Point));
painter.drawPath(m_BiscepLoopPath);

BD is a straightline. Now I have to modify this line to a curve so that BD length become 100 pixel. Stright line BD length is only 50. so the line has bend startpoint B and endpoint D remains same but it should match the length to be 100.

Please help me how can I do it.? Thanks Sujan

stampede
21st November 2013, 16:43
Stright line BD length is only 50. so the line has bend startpoint B and endpoint D remains same but it should match the length to be 100.
If you are scared of the higher math required to calculate this, take a look at QLineF::setLength (http://qt-project.org/doc/qt-4.8-snapshot/qlinef.html#setLength) method.