Results 1 to 4 of 4

Thread: How to draw dynamic new information on painter. (moving elements )

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default How to draw dynamic new information on painter. (moving elements )

    I remember the xor, or, etc Pen setting to draw lines into a 'picture' .
    I used it to move one element without the need of redraw all the content of the vectorial data drawed.
    To get this , what can I use from painter ? Maybe I have to see Graphicscene ?
    Imagine the typical line-point movement. (when edit it wiht the mouse)-.
    First you have to erase the lines from point 1 - EditPoint - Point2, then draw new point1-Editpoint , Editpoint- Point 2. And ths two things at every mouse move.

    Any tips ? Thanks

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to draw dynamic new information on painter. (moving elements )

    Not sure where you are drawing, if it is QGraphicsScene, as you already know use QGraphicsLineItem, and just use QGraphicsLineItem::setLine(x1,y1,x2,y2) on every mouse movement (drawing and erasing is taken care by QGraphicsScene)

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

    tonnot (26th July 2011)

  4. #3
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to draw dynamic new information on painter. (moving elements )

    You can set logical drawing ops if you're drawing over a QImage; see QPainter::setCompositionMode. XOR mode is not longer available for ordinary drawing; the rationale is that modern graphics engines are so fast that there is no downside to simply caching the original background and drawing on top of it. This also makes color rendering more sane.

    I'm not sure I agree with this, but it's the technique used in Qwt for rubberbanding.

  5. The following user says thank you to SixDegrees for this useful post:

    tonnot (26th July 2011)

  6. #4
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to draw dynamic new information on painter. (moving elements )

    Thank you very much

Similar Threads

  1. Replies: 4
    Last Post: 4th March 2011, 09:43
  2. Replies: 0
    Last Post: 24th May 2010, 13:19
  3. Draw dynamic curve with various colors...
    By jiapei100 in forum Qwt
    Replies: 0
    Last Post: 25th October 2009, 04:31
  4. painter's drawPie() function how to draw few sensible PIEZ..
    By salmanmanekia in forum Qt Programming
    Replies: 15
    Last Post: 31st August 2008, 17:52
  5. use Qpainter to draw lines + problem in my painter
    By ReSu in forum Qt Programming
    Replies: 4
    Last Post: 5th March 2008, 16:44

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.