[Interest] How can i manipulate pixel data from a QWidget?

Giuseppe D'Angelo dangelog at gmail.com
Sat Sep 22 21:41:00 CEST 2012

On 22 September 2012 20:00, Mark <markg85 at gmail.com> wrote:
> I want to play with a high performance line drawing algorithm [1] so i
> guess it's not very optimal to do the following:
> - draw in a QImage
> - put that image in the qwidget
> - further drawing in the QImage
> - put it on the QWidget again
> - ... and so on ...

Why doing this? Just paint everything you need to paint on the QImage,
then simply blit it in the paintEvent().

> In this case i'm guessing that the QImage mapping to a QWidget would
> be the most costly one hence i'd like to prevent that altogether and
> "just" manipulate the QWidget pixel data directly.
> So how do i do that?

With a custom QPaintEngine/QPaintDevice combination, and a custom
graphics system that uses it.

Giuseppe D'Angelo

More information about the Interest mailing list