PDA

View Full Version : How to get pixel color from QPainter ??



rameshg87
10th August 2008, 05:22
Hi,
I need to get the color of the pixel that I drew with QPainter. I create a QWidget and wrote my own code for the paintEvent function after setting the widget to opaque mode using Qt::WA_OpaquePaintEvent. Now as I draw more and more pixel I need to get the color of one of the pixels that I drew earlier. Is there any function for it or is there any method by which I can do it ???

jpn
10th August 2008, 08:58
How about drawing on a QImage instead? QImage provides pixel level access. You can draw the image on the widget with QPainter::drawImage().