Important: Please read the Qt Code of Conduct -

QWebEngineView prevents Q3DScatter from being displayed

  • I have a Qt Main Window containing a GridLayout inside of which I added two Group Boxes (one on the left side and the other on the right). I'm aiming to display a Q3DScatter graph in the right group box and a QWebEngineView in the left one, so I've added a horizontal layout in both Group Boxes, then from my main window constructor, I created a widget container for my Q3DScatter graph which I then embedded to the horizontal layout of my right Group Box, and created a QWebEngineView which I added in turn to the horizontal layout of my left Group Box. Here's the full code of my window constructor:

    GraphWindow::GraphWindow(QWidget *parent) :
        ui(new Ui::GraphWindow)
        //Adding the graph to my right horizontal layout (contained in my right Group Box) :
        Q3DScatter *graph = new Q3DScatter();
        QWidget *container = QWidget::createWindowContainer(graph);
        ui->right_horizontalLayout->addWidget(container, 1);
        //Adding the web view to my left horizontal layout (contained in my left Group Box) :
        QWebEngineView *view = new QWebEngineView(this);
        ui->left_horizontalLayout->addWidget(view, 1);

    When executing, the QWebEngineView "page" is displayed properly but the right group box of my window (which is supposed to contain the Q3DScatter graph) appears to be empty. When I comment the QWebEngineView part of my code, the graph is displayed properly, so I deduced that there has to be something wrong with QWebEngineView which apparently doesn't allow my Q3DScatter graph to be displayed. Any help would be very welcome.

    PS: Here are two screenshots, the first is what I get when executing the full code, and the second is when I comment the QWebEngineView part of the code (no web view):

    Full code:

    0_1492765478864_Capture d’écran 2017-04-21 à 9.52.03 AM.png

    Code without adding QWebEngineView:

    0_1492765507825_Capture d’écran 2017-04-21 à 9.48.26 AM.png

    EDIT: I tried resizing the window by completely shrinking it and then re-expanded it, and to my surprise the graph appeared! This is obviously a Qt Bug related to QWebEngineView... Has anyone been confronted to this kind of bug before? Shrinking and then expanding the window is obviously not a solution, I'd really appreciate some actual workaround.

Log in to reply