Problem using QGraphicsVideoItem with QOpenGLWidget
-
Hi,
I'm working on a QWidgets application that uses a QGraphicsView with, among other items, a QGraphicsVideoItem. Currently, we're using a QGLWidget as the viewport for the QGraphicsView.
This works well, but we're now porting part of the application over to QtQuick. We'd like to do the port in steps, so preferable do not want to touch the QGraphicsView/video part yet. However, it seems that switching to the QGraphicsView and then back to the QtQuick UI (embedded using QWidget::createWindowContainer(QQuickView*, QWidget*) ) causes serious issues, as the QtQuick UI will not respond to mouse clicks anymore.
We've been doing some experimenting, and found out that not using a QGLWidget as the viewport for the graphics view fixed this. However, when using a QOpenGLWidget as the viewport, the video is no longer shown. Only a light blue square.
I'm probably missing something obvious or doing something silly. The change in the graphics view code is this:
original code:
auto * viewPortWidget = new QGLWidget(QGLFormat(QGL::SampleBuffers), this)
new code:
QSurfaceFormat format = QSurfaceFormat::defaultFormat(); format.setDepthBufferSize(0); format.setSamples(4); auto* viewPortWidget = new QOpenGLWidget(this); viewPortWidget->setFormat(format);
We'd like to find a solution for one of the two issues.
- Let QtQuick still take mouse clicks after using the graphics view,
- Use graphics view with QOpenGLWidget and QGraphicsVideoItem.
By the way, were presenting QVideoFrame objects with QVideoFrame::Format_YUV420P format. We've checked that the videosurface supports the format.
Another thing: This is on Mac OS X 10.13, with Qt 5.10.
Example of what it looks like:
Thank you for taking the time to read this.
-
Hi
Looking nice
I was wondering if you are .1 version away from fix.
https://bugreports.qt.io/browse/QTBUG-53099