I want to grab screen of my QML application. But my root QML object is ApplicationWindow, so I can\'t use QQuickView to show it. Instead I have to use
ApplicationWindow
QQuickView
You can use rootObjects() and cast its result to QQuickWindow:
rootObjects()
QQuickWindow
foreach(QObject* obj, engine.rootObjects()) { QQuickWindow* window = qobject_cast(obj); if (window) { QImage image = window->grabWindow(); qDebug() << image; } }