OpenGL without using QGLWidget

I would like to use a regular QWidget for my OpenGL drawings, but encounter some problems.

I installed an eventFilter() to capture the paintEvent for the Widget and am doing all my OpenGL drawing code (including swapping buffers) in there.

When I return "true" to stop the event being processed any further, the Widget stays gray.. I can't see my OpenGL stuff at all... when I return "false" it start's to flicker between my own Drawings and the Gray default background.

I also tried to set Attributes like WA_PaintOnScreen and WA_NoSystemBackground, but all they change is that the Widget is no longer gray but black (my OpenGL Clear Color is yellow for test-purposes).

I am pretty sure I am missing something important like an "erasing the background"-event or something, but can't find anything :(

Any help would be realy appreciated!

Cheers,
Keiko

PS: I don't want to use the QGLWidget because we already have our whole Engine including initialisation of OpenGL etc.. all I want to do is to use a QWidget's HWND/HDC (on Windows) as Rendertarget..

You can use a QGLWidget and call your own full OpenGL initialization/paint stuff from within it (initializeGL, paintGL, etc.). You'd just need to give QGLWidget a pointer to your engine and call your own methods from QGLWidget ones. I did something similar myself previously and didn't encountered any issues.

Using a regular QWidget to render OpenGL directly on it is surely a harder thing to achieve. Maybe having a look at QGLWidget source would help a bit, if you haven't done so.

BUT, I noticed our Widget is not just black, actually it's flickering between Black and Yellow (Yellow is our OpenGL Clear Color) - but only when I move the widget to the top of the Screen.. very strange..

And unfortunately I don't see any big difference between our code and the one of QGLWidget.. But there must be a tiny difference hidden somewhere :(

thanks! it solved the flicker problem i encountered last night.
actually i had turned off Qt' paint engine, but it made no difference when in fullscreen mode, so i turned it off some time later. however, in windowed mode, it makes a huge difference.

[quote author="Adrien Leravat" date="1359051022"]are you sure the original QWidget::paintEvent is inhibited ? (just to be sure :) )[/quote]