Results 1 to 3 of 3

Thread: Painting multiple overlapping points with one QPainter

  1. #1
    Join Date
    Dec 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Painting multiple overlapping points with one QPainter

    Hey guys,

    I'm fairly new to C++ and Qt and I have one question about using the QPainter module together with the QTimer. I am currently trying to paint points as part of a function plot. Each point is one part of the plot and as they are pretty close together i just want to paint one point at each timeout() signal. What I've got so far is only one point moving along the function path. How can I do it that the program paints all the points overlapping each other so I can see the path of the point? Do I have to create as many instances of points as I want to display?

    Thanks in advance

    Jules

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Painting multiple overlapping points with one QPainter

    Apparently you are painting directly on some widget or paintdevice or whatever. You could instead paint on a bitmap and after each point blit that to your widget -- each time it will have one new point and all the old ones.

  3. #3
    Join Date
    Dec 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Painting multiple overlapping points with one QPainter

    Yes, I was painting on my main widget. So you say I should create a QPixmap and use the QPainter to paint on that and after each step tell the widget to display the pixmap? I think I'll manage to paint on a pixmap, but could you explain, how I can use that pixmap in the widget?

Similar Threads

  1. Painting in multiple QWidgets simultaneously
    By edepetete in forum Qt Programming
    Replies: 0
    Last Post: 17th October 2011, 17:21
  2. how to draw points with qpainter?
    By athulms in forum Newbie
    Replies: 4
    Last Post: 23rd August 2011, 08:10
  3. Replies: 1
    Last Post: 29th June 2010, 17:59
  4. Replies: 19
    Last Post: 26th November 2008, 19:54
  5. Trouble with image painting (QPainter + QImage)
    By krivenok in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2006, 20:25

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.