Results 1 to 3 of 3

Thread: Translating a QPolygon in a Qpainterpath with round corners

  1. #1
    Join Date
    Sep 2011
    Location
    Mannheim, Germany
    Posts
    22
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Translating a QPolygon in a Qpainterpath with round corners

    Hello community,

    I am writing a Qt application with a diagram surface.
    The diagram contains polygon lines with sharp corners, but I need round ones.
    The Line width must be zero, so using a QPen with rounded corners is no option.

    Is there a simple algorithm that translates a QPolygon in QPainterpath with rounded corners?

    diagram.png


    greets,
    Dennis

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,348
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: Translating a QPolygon in a Qpainterpath with round corners

    If you're drawing your lines with QPainterPath, why not use the QPainterPath "arc" methods to add the rounded corners as arcs? The size of the QRectF occupied by the arc has a width and height equal to the arc radius, so your lines start or end at the endpoint you would have had for square corners minus the radius.

  3. #3
    Join Date
    Sep 2011
    Location
    Mannheim, Germany
    Posts
    22
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Translating a QPolygon in a Qpainterpath with round corners

    It works! Thanks!

Similar Threads

  1. Replies: 1
    Last Post: 28th December 2010, 10:43
  2. QMenu round corners
    By medved6 in forum Qt Programming
    Replies: 9
    Last Post: 17th September 2010, 23:33
  3. QPainterPath and QPolygon
    By Muz in forum Qt Programming
    Replies: 0
    Last Post: 18th September 2009, 08:16
  4. QPainterPath to reduced QPolygon
    By Lodorot in forum Qt Programming
    Replies: 0
    Last Post: 10th September 2009, 00:20
  5. Replies: 2
    Last Post: 24th January 2009, 09:11

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.