Important: Please read the Qt Code of Conduct -

openglContextCreated signal not emitted

  • Hello everyone!

    I would like to ask what's wrong with OpenGL context signal.
    Previously everything was working, until I didn't upgrade QT 5.9.5 -> 5.12.5. Compilation was successful, so I wasn't expecting any problems.

    Currently I am using QT 5.12.5 on embedded platform based on Yocto.

    // main.qml
    import QtQuick 2.0
    import QtQuick.Window 2.0
    import QtWebEngine 1.0
    Window {
        width: 1024
        height: 600
        visible: true
        WebEngineView {
            anchors.fill: parent
            url: "http://localhost"
    // main.cpp
    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QtWebEngine>
    #include <QWindow>
    #include <QQuickWindow>
    #include <QOpenGLContext>
    #include <QDebug>
    void CheckOpenGLContext(QOpenGLContext* ogl_contex)
      qDebug() << "CheckOpenGLContext()";
    int main(int argc, char *argv[])
      QGuiApplication app(argc, argv);
      QQmlApplicationEngine engine;
      QQuickWindow* window = qobject_cast<QQuickWindow*>(engine.rootObjects().first());
      QObject::connect(window, &QQuickWindow::openglContextCreated, [&](QOpenGLContext* ogl_ctx){ CheckOpenGLContext(ogl_ctx); });
      if(window->openglContext() != nullptr) qDebug() << "isValid: " << window->openglContext()->isValid();
      qDebug() << "started";
      return app.exec();

    Application startup:

    ./egl_test -platform eglfs --no-sandbox
    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/var/volatile/tmp/runtime-root'
    Setting framebuffer size is only available with DRM atomic API
    Unable to query physical screen size, defaulting to 100 dpi.
    To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
    isValid:  true

    From the documentation ( I can see Returns if this context is valid, i.e. has been successfully created.. So the signal openglContextCreated wasn't emitted even if, the openglContext is valid already

    Same code on 5.9.5 works without any problems. Signal is emitted and validity check is false, because OpenGL content there is not valid.

    So what's wrong there?

    Thank you,

  • Solved by setting visible: false then calling ->show() showe the window, when I wanted. Later the signal was emitted without problems as before.

Log in to reply