PDA

View Full Version : Drawing graphs



steg90
9th May 2007, 13:02
Hi,

I'm coming from MFC background and when I draw graphs ( realtime ) I have used the device context for drawing to an offscreen and then when finished blitted the offscreen buffer to the main screen ( BitBlt function ). Is there similar methods within QT4 to do this? Draw lines etc and do double buffering?

Kind regards,
Steve

high_flyer
9th May 2007, 13:12
Is there similar methods within QT4 to do this? Draw lines etc and do double buffering?
See QPainter and read about the the paint system (http://doc.trolltech.com/4.2/paintsystem.html)
Reading about Arthur (http://doc.trolltech.com/4.2/qt4-arthur.html)

QPainter does double buffering out of the box.

You might want ot have a look qt Qwt for ready graph plotting solution.

marcel
9th May 2007, 13:12
Painting is double buffered in Qt by default. You can do all your drawing on a widget, and you won't get any flickering.



From Qt 4.0, QWidget (http://www.qtcentre.org/forum/qwidget.html) automatically double-buffers its painting, so there's no need to write double-buffering code in paintEvent() to avoid flicker.

steg90
9th May 2007, 13:27
Wow, that is great, use to had to do lots more work in MFC!

high_flyer
9th May 2007, 13:37
Welcome to Qt!:cool: