Hi, i've a problem with custom QGLWidgets.

Basically what i made is creating one of them. Then i create another (different custom) QGLWidget inside this. The first one should draw nothing and the second one a cube. The problem is when painting them. At first (frame) i see the cube and then all the window gets white.

If i create only one QGLWidget of the second type, the cube is perfectly drawn on the screen so i suppose the first one is hidding the other but i don't know how to resolve it. I've tried with setAutoFillBackground(false) and with setAutoSwapBuffer(false) too (calling swapbuffers at the end of the painting).

Besides, i've tried overloading initializeGL(), resizeGL() and paintGL() and the other way: overloading paintEvent(), calling updateGL() and update() respectively.
I've been looking for something similar to at the forums but i didn't manage to find anything about.
I know there are other ways of doing this (i.e. graphicsView) but i have to do it this way.
Sure i'm missing something but i don't know what. can anyone help me?

thanks in advance,


some of the code:

int main(int argc, char *argv[])
QApplication app( argc, argv );
CGLWidget1 tWidget1;

tWidget1.resize( 800, 600 );

return app.exec();

m_ptWidget2 = new CGLWidget2( this );

QTimer *ptTimer;
ptTimer = new QTimer();
connect( ptTimer, SIGNAL( timeout() ), this, SLOT( updateGL() ) );

ptTimer->start( 50 );

Sorry for the bad code's format but i didn't find any way for making it look better.