The easiest way, I suppose, is to provide QML with a new custom component implemented in C ++. I could not find anything ready.
You can subclass QDeclarativeItem and implement your OpenGL code in the paint function after using QPainter :: beginNative () . After that, you can "export" your new custom element to QML this way . This is pretty simple and should work, but you need to configure the QDeclarativeView viewport as a QGLWidget, something like this:
QDeclarativeView view;
or you will have to use the opengl graphics system for the entire application. Another way is QML / 3D .
This stream will provide you with other information.
source share