Results 1 to 2 of 2

Thread: Draw angle indicator QPainter

  1. #1
    Join Date
    Sep 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Draw angle indicator QPainter

    Hello, I'm trying to draw and angle indicator using QPainter like the following pic
    AutoCAD 2012 Dynamic Input.gif
    I know that the only way to do this is drawArc() but I can't seem to find the proper arguments.
    I have the screen coordinates of the corner center, and of the two endpoints.

    Thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Draw angle indicator QPainter

    You need to use trygonometry to calculate the angles and bounding rectangle of the circle the arc is part of. There is an upright triangle consisting of the corner point, lower end point and its projection onto the horizontal axis. From that you can calculate the length of the projection line and the starting angle. Similar for the other endpoint and the vertical axis -- this will give you the span angle. The bounding rect is then easy to calculate using the two projected lines.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. How does one draw a 'cut down' ellipse using QPainter
    By Eos Pengwern in forum Qt Programming
    Replies: 3
    Last Post: 24th July 2012, 01:01
  2. QTreeView draw drop indicator
    By mentalmushroom in forum Qt Programming
    Replies: 0
    Last Post: 28th September 2011, 09:05
  3. how to draw points with qpainter?
    By athulms in forum Newbie
    Replies: 4
    Last Post: 23rd August 2011, 08:10
  4. Replies: 0
    Last Post: 29th March 2011, 17:54
  5. QPainter::drawText, draw big text
    By franco.amato in forum Newbie
    Replies: 3
    Last Post: 18th March 2010, 08:32

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.