My code looks like this:
QApplication app(argc, argv);
QQmlApplicationEngine app_engine;
app_engine.load("qml/main.qml");
return app.exec();
Could somebody please help me how to make Qt render everything to the buffer I provide? OpenGL must be avoided. I could make this work with QWebPage, but this appears to be much more difficult to me...
I've found the way to get the QML output as QImage, but it works only if the QML window has focus. Incomplete code snippet follows:
While app is running, you can grab window contents like this:
It has several drawbacks (i.e. cursor disappears when the input focus is lost, grabWindow() is very slow etc.).
Furthermore, it's also possible to redirect QML page rendering to a custom FBO, this provides a much faster solution but also suffers from some issues.