Results 1 to 4 of 4

Thread: Ellipse and rotation

  1. #1
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Ellipse and rotation

    Hi,
    I need to draw many shapes in a widget. these shapes are all resizable and rotatable.
    My question is how i can create rotatable ellipse. If i rotate the Qpainter object then all the shapes in the widget are rotating. how can i rotate only Ellipse????

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Ellipse and rotation

    Qt Code:
    1. xxx::paint()
    2. {
    3. // other items
    4. painter.rotate( x° );
    5. // paint your item which should be rotated
    6. painter.rotate( -x° );
    7. // go on
    8. }
    To copy to clipboard, switch view to plain text mode 

    and set the right point/anchor for the rotating.

  3. #3
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Ellipse and rotation

    thank You.... it worked
    But i am facing one more issue because of this... if i rotate the painter, this rotation effects on upcoming shapes. fro ex. if i draw ellipse and next rectangle, then rotating ellipse, rotate the rectangle too...
    how i can rsolve this????
    Last edited by navi1084; 9th March 2009 at 10:16.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Ellipse and rotation

    You must rotate your painter back as mentioned via "-x°". Or you can use save and restore before and after drawing your rotated item.

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.