PDA

View Full Version : Cannot capture the QGLwidget with grabWidget or grabWindow (Snap Shot ) .



vaibhavjoshi28
5th September 2013, 08:44
Hi ,

I have MID area which contains QGLWidgets as its subWindows .
I am able to grab the snap Shot for these QGLwidgets with grabWidget and grabWindow APi's .

But now i want my QGLWidget to have gradient background so i Used Qpainter in QGLWIdget::paintEvent
and set QGL::setPreferredPaintEngine(QPaintEngine::OpenGL) as it was throwing some exception during the creation of QPainter .

Now my QGLWidgets are rendered correctly with the required gradient background but i am not able to grab the snapshot for these QGlwidgets with grabWidget and grawindow APi's ..
It captures black screen for these QGLwidget areas..

Is my approach right ..Its likly that QGL::setPreferredPaintEngine(QPaintEngine::OpenGL) is causing the trouble..

What approach should i go with to grab (Snapshot )for QGlwidgets that are painted to have gradient background .

Thanks,

Awaiting for response ...

vaibhavjoshi28
6th September 2013, 11:26
HI ,

I could partially solve this problem my not using QPainter but by using direct OpenGL calls to render the gradient on QGLwidget .

With this approach grabWidget works fine and generates the desired output but grabWindow does not work properly? .


Any thought on this ?