PDA

View Full Version : Using QGraphics Items/Scenes/Views with a QGLWidget



ferebia
23rd May 2016, 21:27
I have been tasked with drawing 2D objects that have been subclassed from QGraphicsItems in QT onto a projected 2D osgEarth Map.

I have been reading the various forums and have learned that there is no easy way of combining osgearth::qtgui::viewerwidget(QGLWidgets) and QGraphics and the quick fix is to set the QGraphicsView's viewport as my qGLWidget.
I have attempted this but it does not produce the desired effect.

I would like to both have a dynamic/user controllable map which I have before setting the viewport, and a controllable qgraphicsview but if i set the view port with my projected map I lose control of the map.

I have to believe that there have been other people that have attempted this project I am looking for someone to throw out a lifeline.

I am rather new to osgEarth but reasonably versed in Qt and C++.

wysota
24th May 2016, 06:56
What exactly have you tried? Setting osgearth::qtgui::viewerwidget as Graphics Views's viewport had a chance of working.

ferebia
24th May 2016, 14:25
Setting the viewer widget as the viewport in my case is like setting the background for the qgraphicsview however it sets in the bottom left corner of the widget and all of the my attempts at enlarging it to fit the size of the widget fail. And I can no longer zoom/pan/rotate the map.

Other than that I have worked through QProxyWidget until I read qglwidgets are not support of which a qtviewerwidget is subclass of that.

My end goal is to create a map that has the controls mentioned above and where I can draw players such as ground vehicles that I can zoom into.

wysota
30th May 2016, 22:34
Maybe you need to apply some transform to the map?