Results 1 to 3 of 3

Thread: QpainterPath - odd fragment at the beginning

  1. #1
    Join Date
    Jun 2021
    Posts
    3
    Thanks
    1
    Qt products
    Qt5

    Default QpainterPath - odd fragment at the beginning

    I created the most simple arc with the following code and paint it with a 50px wide QPen. There are no other elements in the path. Can anyone help me to find the cause of the strange triangle at the start of the arc?

    Screenshot.jpg

    Qt Code:
    1. QRectF rect(pCenter.x() -200.0, pCenter.y() -200.0, 400.0,400.0);
    2. QPainterPath path = QPainterPath(QPointF(881.421,398.579));
    3. path.arcTo(rect,45,45);
    4. painter.drawPath(path);
    5. qDebug() << "pCenter:" << pCenter;
    6. qDebug() << "path:" << path;
    To copy to clipboard, switch view to plain text mode 

    The debug printout is:
    pCenter: QPointF(740,540)
    path: QPainterPath: Element count=5
    -> MoveTo(x=881.421, y=398.579)
    -> LineTo(x=881.421, y=398.579)
    -> CurveTo(x=845.228, y=362.386)
    -> CurveToData(x=795.228, y=340)
    -> CurveToData(x=740, y=340)

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    503
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QpainterPath - odd fragment at the beginning

    Hi, the docs for arcTo() say "Note that this function connects the starting point of the arc to the current position if they are not already connected.". Maybe this creates your extra triangle?

    Ginsengelf

  3. The following user says thank you to Ginsengelf for this useful post:

    derschuhmann (30th June 2021)

  4. #3
    Join Date
    Jun 2021
    Posts
    3
    Thanks
    1
    Qt products
    Qt5

    Default Re: QpainterPath - odd fragment at the beginning

    Hy Ginsengelf, that is a great hint! As in my path there is noting but this arc that could be my problem. Thanks! I'll have a look into that.

Similar Threads

  1. QPainterPath::quadTo(...) calls QPainterPath::cubicTo(...) ?
    By brucelamond in forum Qt Programming
    Replies: 0
    Last Post: 29th April 2011, 00:30
  2. Fragment shader with 2d
    By krzat in forum Newbie
    Replies: 1
    Last Post: 20th December 2010, 22:37
  3. Extracting xml fragment from QXmlStreamReader
    By Gopala Krishna in forum Qt Programming
    Replies: 5
    Last Post: 1st December 2007, 10:14
  4. GLSL shaders - keeping a value per fragment iteration
    By high_flyer in forum General Programming
    Replies: 3
    Last Post: 22nd June 2007, 16:22
  5. Failed to create fragment programs.
    By jeeman in forum Qt Programming
    Replies: 5
    Last Post: 19th June 2007, 01:03

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.