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

Mark markg85 at gmail.com
Sat Sep 22 21:52:19 CEST 2012

On Sat, Sep 22, 2012 at 9:41 PM, Giuseppe D'Angelo <dangelog at gmail.com> wrote:
> 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.
> Cheers,
> --
> Giuseppe D'Angelo

Oke, i will go the QImage route for now :) It does seem like the easiest way.

More information about the Interest mailing list