Hello,
I am trying to add widgets on top of an existing QGLWidget.
I have followed this and trying to implement it into my code.
Here is some code:
...
// occView derives QGLWidget
myOccView = new occView(myContext, this);
GraphicsView* view = new GraphicsView();
view->setViewport(myOccView);
view->setScene(new OpenGLScene);
view->show();
view->resize(1024, 768);
view->raise();
...
...
// occView derives QGLWidget
myOccView = new occView(myContext, this);
GraphicsView* view = new GraphicsView();
view->setViewport(myOccView);
view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
view->setScene(new OpenGLScene);
view->show();
view->resize(1024, 768);
view->raise();
...
To copy to clipboard, switch view to plain text mode
It opens the normal QGLWidget, and also opens in a seperate window the graphics view.
But then programme crashes at view->setViewport(myOccView);
http://postimg.org/image/wl7fd315t/
and says:
QWindowsGLContext::makeCurrent: SetPixelFormat() failed (The pixel format is invalid.)
ASSERT: "context" in file opengl\qopenglfunctions.cpp, line 194
qwidget::repaint: recursive repaint detected
If I remove:
view->setViewport(myOccView);
It doesn't crash and opens the two windows :
http://postimg.org/image/ewmy1uarb/
So I am wondering how I attach the graphicsView to my QGLWidget. I think this will solve the crash.
Thank you.
Bookmarks