Results 1 to 2 of 2

Thread: drawing series of rotated ellipses

  1. #1

    Default drawing series of rotated ellipses

    Hi!

    I'm trying to draw a bunch of rotated ellipses, but I'm not getting the results I want.

    I have a class subclassing QGraphicsItem. In the paint function, let's say I want to draw an ellipse (width: 6, height 2) rotated at 10 degrees, 20 degrees and 30 degrees at 3 different locations. How would I do that? I've tried the following, but I don't think my understanding of rotate is quite right.

    painter->rotate(-10);
    painter->drawEllipse(location1, 6, 2);
    painter->rotate(+10);

    painter->rotate(-20);
    painter->drawEllipse(location2, 6, 2);
    painter->rotate(20);

    painter->rotate(-30);
    painter->drawEllipse(location3, 6, 2);
    painter->rotate(30);


    Thanks for any help you can provide!

  2. #2
    Join Date
    Dec 2009
    Location
    Bratislava, Slovakia
    Posts
    11
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: drawing series of rotated ellipses

    Qt Code:
    1. ellipse->rotate(...);
    2. ellipse->paint(painter);
    To copy to clipboard, switch view to plain text mode 

    See QGraphicsEllipseItem documentation for supplied methods like rotate, setPos, ...

Similar Threads

  1. Problems with QString
    By cyberboy in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2008, 09:18

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.