Qt——在一个3D场景中包含QGraphicsView的多个层(QGLWidget)

时间:2022-05-17 05:36:54

I'm currently evaluating the possibilities to implement a navigable 3D scene which allows to render multiple 2D layers. To be a bit more precise, I would like to display multiple graphs in a 3D environment in order to pinpoint simularities and differences between those graphs. Considering the following screenshot, there would be two graphs (one black, one grey), which are equivalent - for different graphs, deviant nodes might, i.e, be highlighted in red.

我目前正在评估实现可导航的3D场景的可能性,该场景允许渲染多个2D层。更准确地说,我希望在3D环境中显示多个图形,以便精确地指出这些图形之间的模拟和差异。考虑到下面的截图,将会有两个图(一个黑色,一个灰色),它们是等价的——对于不同的图,异常节点可能是i。用红色突出显示。

Qt——在一个3D场景中包含QGraphicsView的多个层(QGLWidget)

I am working with Qt's Graphic View Framework and established an editable graph editor using QGraphicsScene and several QGraphicsItems, which I separately from this project.

我正在使用Qt的图形视图框架,并使用QGraphicsScene和几个QGraphicsItems建立了一个可编辑的图形编辑器,这是我与这个项目分离的。

Qt provides OpenGL support, e.g., the QGLWidget and I had a look at the provided examples. Given, that I have not worked with OpenGL (I did some work with Java3D though) I would love if some people can share their experience.

Qt提供OpenGL支持,例如QGLWidget和我查看了提供的示例。考虑到我没有使用OpenGL(虽然我使用过Java3D),如果有人能分享他们的经验,我会很高兴。

Several solutions came to my mind:

我想到了几个解决办法:

  1. Render every QGraphicsView to a QPixmap and display them in 3D, which would make the graphs navigatable but would prohibit any picking of elements etc.
  2. 将每个QGraphicsView呈现给一个QPixmap,并在3D中显示它们,这将使图形导航,但会禁止任何元素的选择等。
  3. Create an equivalent 3D element for every 2D graph element and "transform" every QGraphicsView into an 3D representation. I guess this would be quite some work (espacially as I have not worked with OpenGL)
  4. 为每个2D图形元素创建一个等效的3D元素,并将每个QGraphicsView“转换”为3D表示。我猜这将是相当艰巨的工作(特别是因为我没有与OpenGL合作)
  5. Maybe there is an easy way to "place" the QGraphicScenes, the view, or just the QGraphicsItems in a QGLWidget without many adaptions and still register the usual "mouseclickevents" etc.
  6. 也许有一种简单的方法可以在QGLWidget中“放置”qgraphicscene、视图,或者仅仅是QGraphicsItems,而无需进行许多修改,并且仍然注册通常的“mouseclickevents”等等。

For a first implementation a plain navigable "viewer" which displayes multiple graphs in different layers would sufficient. But I would like to keep it extendable in order to add, e.g., picking, in the future.

对于第一个实现,一个普通的可导航的“查看器”(它在不同的层中显示多个图)就足够了。但是我想保持它的可扩展性,以便在将来添加,例如,选择。

1 个解决方案

#1


0  

The Qt3D project provides a class called QGraphicsEmbedScene which does exactly what you are asking for.

Qt3D项目提供了一个名为QGraphicsEmbedScene的类,它的作用与您所要求的完全相同。

#1


0  

The Qt3D project provides a class called QGraphicsEmbedScene which does exactly what you are asking for.

Qt3D项目提供了一个名为QGraphicsEmbedScene的类,它的作用与您所要求的完全相同。