QVTKOpenGLNativeWidget in QGraphicsView Causing White Screen in Qt 6.5.6

We are currently in the process of porting our project from Qt 5.15 to Qt 6.5.6. In Qt 5.15, we were successfully using QGLWidget in conjunction with QGraphicsView. However, after the upgrade to Qt 6, we have replaced QGLWidget with QOpenGLWidget due to the deprecation of QGLWidget. Unfortunately, this change has caused an issue when setting the viewport for QGraphicsView using setViewport().

The issue we are facing is that when we call setViewport() with QOpenGLWidget, it results in a white screen, and we are unable to see the 3D image in QVTKOPENGLNATIVEWIDGET. However, if we comment out the setViewport() line, the rest of the functionality works fine, but this is not an option as setViewport() is required for further processing in our application.

Additionally, we have tried enabling Qt::AA_ShareOpenGLContexts and setting a shared OpenGL context, but neither approach resolved the issue. Here is the relevant part of the code:

QGraphicsScene* scene = new QGraphicsScene();
graphicsView->setScene(scene);

QSurfaceFormat fmt;
fmt.setSwapInterval(0); // Turn off vSync.
fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);

QOpenGLWidget* openGLWidget = new QOpenGLWidget();
openGLWidget->setFormat(fmt);

// Commenting setViewport works fine, but setViewport causes a white screen
// graphicsView->setViewport(openGLWidget);
graphicsView->resize(800, 600);

// Graphics widget contains OpenGLWidget which loads a 3D image, graphics widget has QVTKOPENGLNATIVEWIDGET
scene->addItem(view->graphicsWidget());

graphicsView->setFrameStyle(QFrame::NoFrame);
graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
graphicsView->setOptimizationFlag(QGraphicsView::DontSavePainterState);

graphicsView->show();

Could you please review this issue and provide guidance on how to resolve it? Any suggestions on getting the QOpenGLWidget to work properly with setViewport() would be greatly appreciated.