Important: Please read the Qt Code of Conduct -

Possible to have web view on top of OpenGL widget.

  • I have a Qt application which uses a QGLWidget to start a window and load an openGL application. All drawing is done with pure OpenGL in this application right now.

    I am hoping to figure out a way to integrate and overlay a Web view (of some sort) over the OpenGL context. Ideally I can just have the new widget be on top of the OpenGL context, but if that is not possible I suppose I could resize the OpenGL context (say to half the window width) and have the Web on the other half.

    Anyways, I have tried the following, and all I got was a white screen (but strangely if I click and drag I can copy the correct text out).

        QMainWindow window;
        QGraphicsView* viewp = new QGraphicsView();
        viewp->setScene(new QGraphicsScene(viewp));
        MyGLWidget* gl = new MyGLWidget();
        QGraphicsWebView web view;

    If I don't add the QGraphicsWebView, then I do see the OpenGL context, but rendered terribly. To me this means that a GL widget cannot be drawn inside a QGraphicsView. I have looked around quite a bit for ways to do this and haven't come up with anything useful.

    FYI, I am using Qt5.4 right now, and am willing to look at the 5.5 rc1 release. I also don't have a preference between QWebView and QWebEngine.

    Any pointers?