PDA

View Full Version : QGraphicsView with custom QGLWidget



scarecr0w132
9th December 2013, 04:39
I am trying to integrate this:
http://doc.qt.digia.com/qq/qq26-openglcanvas.html
But I want to use a third party library that does the rendering.
The class that currently renders is derived from QGLWidget.

This is how it currently draws:


void occView::paintEvent( QPaintEvent* e )
{
aView->Redraw();
}


My current code:


myOccView = new occView(myContext, this);
GraphicsView *view = new GraphicsView();
view->setViewport(myOccView);
view->setViewportUpdateMode(QGraphicsView::FullViewportU pdate);
view->setScene(new OpenGLScene);
view->resize(1024, 768);
view->show();

this results in http://postimg.org/image/wl7fd315t/
You can also see that they are in different windows.

QWindowsGLContext::makeCurrent: SetPixelFormat() failed (The pixel format is invalid.)
ASSERT: "context" in file opengl\qopenglfunctions.cpp, line 194
qwidget::repaint: recursive repaint detected

So I am obviously doing something wrong..
Do I have to redraw it in
QGraphicScene::DrawBackground

Thank you

ChrisW67
9th December 2013, 05:19
We have insufficient information to tell you exactly what is going on. The first code snippet is from a class called myView is unrelated to the second code snippet.

scarecr0w132
9th December 2013, 05:26
We have insufficient information to tell you exactly what is going on. The first code snippet is from a class called myView is unrelated to the second code snippet.
Thank you for pointing that out :)

scarecr0w132
18th December 2013, 22:18
bump :)

scarecr0w132
20th December 2013, 08:14
I have attached a basic version of my program.
Could someone who has experience please help me with adding QWidgets to custom QGLWidget.

Thank you!