Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Draw own QQuickItem using OpenGL together with QQuickApplicationEngine



  • Hello,
    I am trying to start a new application and want to start with the most modern possible codebase so I am looking into different options. The application I want to develop consists of a large OpenGL-View togehter with some slider next to it to change some parameters of the view. I have a large experience in building widget based applications in Qt but just for the fun, I want to go for QML way.

    I found this example that shows how to combine OpenGL-Drawing with with QML-Items:
    http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html

    Then I found the Qt Quick Controls template in QtCreator that uses QQuickApplicationEngine which seems even more sophisticated than just using a QQuickView with a QML-File as a root item.

    I tried adopting the first example to use QQuickApplicationEngine by changing the main-method according to the template and changed the main.qml to use ApplicationWindow instead of Item as the root object. The effect is that I see all the QML Items in a window but the custom opengl drawing is not displayed. I see from the debugger that the opengl drawing code is executed.

    I would like to share my adopted example with you but I am unable to find a way to attach a file here. I guess that I just did something very stupid and the viewport of my custom opengl items is something like 0x0.

    I would be very happy if there was a an example that uses QQuickApplicationEngine to load a qml-file with an ApplicationWindow and that does some OpenGL drawing besides QtQuick based controlls.

    Any help is greatly appriciated.


Log in to reply