2

I'm going to start development on my vectorial viewer app. I have explored the 2D and 3D Qt tools and I have the impression that I have to create two independents data worlds. The QGrapchicsScene needs 'items', the OpenGL needs raw data. What is your opinion ?

Christian Rau
  • 45,360
  • 10
  • 108
  • 185
tonnot
  • 435
  • 1
  • 5
  • 17

1 Answers1

2

Only way I've seen to do this is to use the paradigm layed out in the "Boxes" demo accessible from the qtdemo executable which is included with Qt.

Basically you must subclass QGraphicsScene and place all of your openGL code into your subclass's overridden version of the virtual drawBackground() function. Then you place a QGraphicsView (or subclass thereof) in your UI, and use QGraphicsView::setViewPort(QWidget *) to put a QGLWidget in as the graphics view's viewport, which will allow your drawBackground code to use openGL.

Michael Daum
  • 820
  • 6
  • 12