Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, March 2008
Re: QGraphicsView with QGLWidget gets not updated without scene


Message 1 in thread

Albert Zhykhar wrote:
> Hi,
> 
> in my program i have a widget derived from QGraphicsView and have to
> switch between few scenes with QGraphicsView::setScene(myNextScene).
> It's also possible to have myNextScene=0, so one sees then the background
> color of QGraphicsView's viewport.
> 
> The problem is that if I set the viewport to QGLWidget and myNextScene=0
> GraphicsView background gets not updated and stays corrupted or maybe 
> better
> to say will not be cleared.
> 
> Alas, i have no experience with OpenGL.
> Could someone point me in the right direction?
> 
> Thanks in advance,
> Albert

I solved the problem by using special empty QGraphicsScene object.
So, whenever the current scene is set from outside to null (myNextScene=0),
I call internaly QGraphicsView::setScene(myEmptyScene).

Happy coding

--
 [ signature omitted ]