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.

    1. Let QtQuick still take mouse clicks after using the graphics view,
    2. 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:

    alt text

    Thank you for taking the time to read this.


  • Qt Champions 2017

    Hi
    Looking nice
    I was wondering if you are .1 version away from fix.
    https://bugreports.qt.io/browse/QTBUG-53099



  • @mrjj You're right, we're on 5.10.0. We'll do the update to 5.10.1 (or 5.11) and send an update.


  • Qt Champions 2017

    @Ilja
    I cross fingers it was just a bug and it it will just work in the later version :)



  • @mrjj Thanks a lot for your quick reply. Upgrading to 5.11 did the trick.


  • Qt Champions 2017

    @Ilja
    Super good to hear.
    Thank you for the feedback.
    happy programming.



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.