Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. openglContextCreated signal not emitted

openglContextCreated signal not emitted

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 398 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    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[])
    {
      QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
      QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
    
      QGuiApplication app(argc, argv);
      QtWebEngine::initialize();
    
      QQmlApplicationEngine engine;
      engine.load(QUrl(QUrl("./main.qml")));
    
      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
    started
    

    From the documentation (https://doc.qt.io/qt-5/qopenglcontext.html#isValid) 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,
    Andy

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Andy99
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved