Important: Please read the Qt Code of Conduct -

using QOpenGLWidget as viewPort for QGraphicsView in Scene doesn't work?

  • on mac, using the recommended method of installing an OpenGL widget into the QGraphicsView doesn't seem to work.

    eg: open the default example code "Video Graphics Item", then at the top of VideoPlayer::VideoPlayer, add this code:

    graphicsView->setViewport(new QOpenGLWidget());

    when you run and open an HD h.264 movie and play it, you get no video, and a zillion of these in the log:

    Failed to activate video surface
    QOpenGLFunctions created with non-current context
    QPainterVideoSurface: Vertex shader compile error

    happens regardless of whether i set the default surface format before startup.

  • does anybody have any clue here?

    i'm following the documentation but the doc is apparently wrong :(

  • Lifetime Qt Champion


    IIRC, the QGraphicsVideoItem already uses OpenGL to do its job so I'd take a look at context sharing. I can't guarantee it will work but it's worth a try.

  • I have already tried that, to no avail. It's unrelated since this is all in the same window anyway.

    My question is why does following the method explicitly recommended by the canonical documentation cause errors?

  • if you think this bug is important, please vote for it

Log in to reply