Results 1 to 2 of 2

Thread: Draw QtCanvasElipse on mouse press event position

  1. #1
    Join Date
    Apr 2006
    Location
    Saint-Petersburg, Russia
    Posts
    63
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Draw QtCanvasElipse on mouse press event position

    Hello, All !

    I want to draw QtCanvasEllipse object on QtCanvas, I do
    Qt Code:
    1. ...
    2. QtCanvasEllipse *ellipse = new QtCanvasEllipse ( 100, 100, view->canvas() );
    3. ellipse->move ( event->pos().x(), event->pos().y() );
    4. ellipse->setPen ( QPen( Qt::DashDotLine ) );
    5. ellipse->setZ ( 10000 );
    6. ellipse->show ( );
    7. view->canvas()->setChanged ( view->viewport()->rect() );
    8. view->canvas()->update();
    9. ...
    To copy to clipboard, switch view to plain text mode 
    but nothing drawing. I think that I move ellipse to position far from canvas. Which way I have to draw ellipse with mouse press event center ?

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Draw QtCanvasElipse on mouse press event position

    Have a look at this: http://www.digitalfanatics.org/proje...chapter12.html - it shows howto use the canvas and how to respond to mouse events.

  3. The following user says thank you to e8johan for this useful post:

    YuriyRusinov (27th June 2006)

Similar Threads

  1. QStackerWidget and mouse events
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2006, 19:25
  2. Qt4.1 Mouse Position & Scaling
    By Paul Drummond in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2006, 19:02
  3. Clearing a QLabel since the mouse position
    By SkripT in forum Qt Programming
    Replies: 10
    Last Post: 18th January 2006, 18:23

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.