Results 1 to 2 of 2

Thread: QPainterPath line to curve

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Posts
    189
    Thanks
    2

    Default QPainterPath line to curve

    I have drawn a straight line using QPainterPath.
    Qt Code:
    1. QPainter painter(this);
    2. path.moveTo(QPointF(B_Point));
    3. path.lineTo(QPointF(D_Point));
    4. painter.drawPath(m_BiscepLoopPath);
    To copy to clipboard, switch view to plain text mode 
    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

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QPainterPath line to curve

    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 method.

Similar Threads

  1. Replies: 1
    Last Post: 29th September 2013, 09:12
  2. Replies: 2
    Last Post: 26th July 2013, 14:25
  3. How to create a text along with curve using QPainterPath
    By achayaan in forum Qt Programming
    Replies: 7
    Last Post: 12th June 2012, 06:20
  4. QPainterPath::quadTo(...) calls QPainterPath::cubicTo(...) ?
    By brucelamond in forum Qt Programming
    Replies: 0
    Last Post: 28th April 2011, 23:30
  5. Replies: 2
    Last Post: 24th April 2009, 17:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.