#include "oimageprovider.h" #include "oboy.h" OImageProvider::OImageProvider(QQmlApplicationEngine &engine) : QQuickImageProvider(QQuickImageProvider::Image) , _engine(engine) { } QImage OImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) { QList roots = _engine.rootObjects(); OBoy *oboy = roots[0]->findChild("qml_oboy"); if (!oboy) { qFatal("Cannot find oboy instance."); } Q_ASSERT(oboy->loaded()); QImage img = oboy->backgroundMap(0); return img; }