PDA

View Full Version : OpenGL in a QWidget: overlapping windows cause non-overlapped areas not to be drawn



cmaire
1st September 2009, 09:23
We have a child widget that uses opengl, and this widget is a child of a tabview. And if another application, and some QMenus of our own process, overlaps our opengl widget,only the area that was overlapped never gets redrawn... and the pixels that do not get updated are that only of what was not overlapped. We need to switch tabs or minimize and restore the window for it to get restored, or sometimes it fixes itself after several seconds. We have one machine that almost never exhibits this behavior, and others where it is 100% consistent. We have the following attributes set for the widget:


setAutoFillBackground( false );
setAttribute (Qt::WA_OpaquePaintEvent);
setAttribute( Qt::WA_NoSystemBackground );
setAttribute( Qt::WA_NativeWindow );
setAttribute( Qt::WA_PaintOnScreen, true );
setAttribute( Qt::WA_StyledBackground,false);

Is there a way to invalidate this region for qt to auto correct this or another solution to this problem? To clarify, we use our own QWidget for rendering with OpenGL, not a OGLWidget.

We have tried removing Qt::WA_OpaquePaintEvent, with no effect. We have also tried placing the following within the paintEvent:


HWND winId = this->winId ();
RECT r;
r.left = 0;
r.top = 0;
r.bottom = fHeight_;
r.right = fWidth_;

BOOL result = InvalidateRect (winId, &r, true);

This fixes the problem but creates constant flashing. We have also tried calling that every x seconds using a QTimer, but the flash every few seconds is very noticeable. We have also tried:


HWND winId = this->winId ();
BOOL result = InvalidateRgn(winId, NULL, false);

Within the paintEvent, this causes other parts of the GUI to become very slow and minimally responsive, especially tabs and context menus. If we run the code every x seconds via a QTimer, it has no effect on the problem.

Any ideas?