Results 1 to 3 of 3

Thread: How to draw a semi circle or arc of ellipse

  1. #1
    Join Date
    Jul 2009
    Posts
    17
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to draw a semi circle or arc of ellipse

    Hi i'm getting crazy looking how to draw an arc of circle or arc of ellipse but without connecting the actual position with the start of the circle.

    I'm using QPainterPath and the function arcTo. But arcTo adds a line from the origin to the begin of the curve.

    instead of :
    __
    \__/

    I want

    \__/

    Without the line (radious)

    How can i make only a curve ??

    Thanks

  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: How to draw a semi circle or arc of ellipse

    I'd say you should use QPainterPath::arcMoveTo().
    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.


  3. #3
    Join Date
    Jul 2009
    Posts
    17
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to draw a semi circle or arc of ellipse

    Thank you.
    I less a little example for other people

    Qt Code:
    1. #include <QApplication>
    2. #include <QGraphicsEllipseItem>
    3. #include <QGraphicsScene>
    4. #include <QGraphicsView>
    5.  
    6. int main( int argc, char **argv )
    7. {
    8. QApplication app(argc, argv);
    9.  
    10. scene.setSceneRect( -100.0, -100.0, 200.0, 200.0 );
    11.  
    12. QPainterPath* path = new QPainterPath();
    13. path->arcMoveTo(0,0,50,50,20);
    14. path->arcTo(0,0,50,50,20, 90);
    15.  
    16. scene.addPath(*path);
    17.  
    18. QGraphicsView view( &scene );
    19. view.show();
    20. return app.exec();
    21. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. What is the fastest way to draw a circle ?
    By Vladimir in forum Qt Programming
    Replies: 18
    Last Post: 6th September 2007, 17:26

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.