[Qt-interest] disappearing widgets in QGraphicsScene

Yifei Li yifli at mtu.edu
Tue Nov 10 02:37:41 CET 2009


Hi,

I kinda fixed the problem by saving and then restoring modelview and projection matrices.

However, the problem still persists when I enable multiple viewports. I tried glPushAttrib/glPopAttrib, but that did not help.

Here is what I tried:

void drawBackground(QPainter*, const QRectF&)
{
   glClearColor(...)
   glClear(...);          // clear depth and color buffer

   glPushAttrib(GL_ALL_ATTRIB_BITS);
   glMatrixMode(GL_PROJECTION);
   glPushMatrix();
   glMatrixMode(GL_MODELVIEW);
   glPushMatrix();

   // render stuff in the 1st viewport
   ...
   // render stuff in the 2nd viewport
   ...

   glMatrixMode(GL_PROJECTION);
   glPopMatrix();
   glMatrixMode(GL_MODELVIEW);
   glPopMatrix();
   glPopAttrib();
}

Please help me out. Thanks

Yifei
----- Original Message -----
From: "Yifei Li" <yifli at mtu.edu>
To: "qt-interest" <qt-interest at trolltech.com>
Sent: Monday, November 9, 2009 10:11:47 AM GMT -05:00 US/Canada Eastern
Subject: [Qt-interest] disappearing widgets in QGraphicsScene

Hi folks,

I have a class derived from QGraphicsScene and I reimplemented drawBackground to render 3D objects using opengl.

I also embeded several widgets in my scene. Those widgets show up fine at the begining, but after I load and display 3D objects, they 'disappear'.

However, I can still manipulate one widget without seeing it ( I know it's there because the shape of cursor will be changed on mouse hover events ). So I guess other widgets (QLabels) are also there but just invisible.

Can anyone tell me what could be the reason? Thanks

Yifei

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list