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

Mark markg85 at gmail.com
Sat Sep 22 21:25:42 CEST 2012

On Sat, Sep 22, 2012 at 9:15 PM, Josiah Bryan <josiahbryan at gmail.com> wrote:
> Subclass QWidget::paintEvent(QPaintEvent*)
> (http://doc.qt.digia.com/4.6/qwidget.html#paintEvent) and do your own
> painting of the widget. See the Analog Clock example
> (http://doc.qt.digia.com/4.7-snapshot/widgets-analogclock.html) for an
> example on how to draw the contents of the widget.
> If you're wanting to do per-pixel work - the easiest (only?) way is via a
> QImage - there is no direct per pixel access to video memory. The closest
> thing you'll get to direct-pixel access of video memory is to use a
> QGLWidget and implement pixel shaders.
> On Sat, Sep 22, 2012 at 3:00 PM, Mark <markg85 at gmail.com> wrote:
>> Hi,
>> I know one can manipulate pixel data in a QImage using the bits()
>> function, but how can i do the same for a QWidget?
>> 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 ...
>> 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?
>> Cheers,
>> Mark
>> [1] http://free.pages.at/easyfilter/bresenham.html
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest

Thank you for your reply :)

Though that is sadly not going to work. Remember, i want to test out
another line drawing algorithm.. not the one from QPainter.
QGLWidget and pixel shaders is also not an option. I first want to do
this in software, not hardware/opengl.

I could really use some way to get the widget pixel data...

More information about the Interest mailing list