QOpenGlWidget as the viewport for QGraphicsView, when an item triggers an update, the paint of all elements is called
-
I am working on a QGraphicsView project and using QOpebGlWidget as the viewport for QGraphicsView to achieve accelerated rendering in OpenGL. In the test, I have two items, and when I actively trigger an update for one item, the paint function for both items is triggered. I set the viewportUpdating Mode of QGraphicsView to QGraphicsView::MinimalViewportUpdate, I want to know why this is and if there is a way to solve it. Thank you for your answers.
-
I think it’s not related to QOpenGLWidget, but rather to the ViewportUpdateMode of QGraphicsView. By default, it uses FullViewportUpdate. You could try switching to SmartViewportUpdate or MinimalViewportUpdate and see if that makes a difference.
-
I tried all the ViewportUpdating Modes of QGraphicsView but it didn't work. However, when I didn't set QOpenGlWidget to the viewPort of QGraphicsView, triggering an update for a single item in the same scence wouldn't trigger the paint function for other items