Results 1 to 7 of 7

Thread: Drawing an arc.

  1. #1
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Drawing an arc.

    Hi,

    I want to draw a few arcs but i see that the arc drawing not very consistent. Can some one please help me?

    I use the following code :

    Qt Code:
    1. paint->drawArc(left,top,15,20,16*80,16*100);
    2. paint->drawArc(right,top,15,20,0,16*100);
    To copy to clipboard, switch view to plain text mode 

    And I get the following result.



    Note that for the images to be mirror of each other the two red pixels should be drawn which QPainter is not drawing. Can some one please tell me why is this happening?
    Is my code right?

    Thanks a lot.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Drawing an arc.

    It's caused by rounding in integer arithmetic.

    If you want to make it look better, use the QPainter::drawArc() method which uses floating point precision and maybe even set antialiasing on (QPainter::setRenderHint()).
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Drawing an arc.

    The problem is that I currently on Qt 3.3.6.

  4. #4
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Drawing an arc.

    Any ideas on how I can solve this problem. I want a mirror image of one of them.

    Thanks a lot.

  5. #5
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Drawing an arc.

    I have been try hard to solve this problem but in vain.

    Can you guys help me making the mirror image of the one which is correct ?

    I tried rotating the QPainter but its not working.

    Pls Help
    Thanks a lot

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Drawing an arc.

    Quote Originally Posted by munna
    I tried rotating the QPainter but its not working.
    You should rather scale it by (-1, 1) and then translate by (width, 0).

  7. #7
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Drawing an arc.

    Quote Originally Posted by jacek
    You should rather scale it by (-1, 1) and then translate by (width, 0).
    I tried this but scale is not working.

    Pls Help

    Thanks.

Similar Threads

  1. [SOLVED] QTreeView drawing selection with icons
    By Timewarp in forum Qt Programming
    Replies: 7
    Last Post: 7th February 2013, 07:52
  2. Replies: 2
    Last Post: 26th April 2006, 10:43
  3. Drawing using QT
    By Kapil in forum Newbie
    Replies: 1
    Last Post: 17th March 2006, 04:23
  4. Drawing over content widgets? (overlay)
    By sertrem in forum Qt Programming
    Replies: 2
    Last Post: 17th January 2006, 22:18
  5. Replies: 4
    Last Post: 17th January 2006, 17:46

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.