Display maps from OCaml
This commit is contained in:
parent
d4e753a6e1
commit
35ea1690fe
11 changed files with 121 additions and 10 deletions
22
src/qt/oimageprovider.cpp
Normal file
22
src/qt/oimageprovider.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#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<QObject*> roots = _engine.rootObjects();
|
||||
OBoy *oboy = roots[0]->findChild<OBoy*>("qml_oboy");
|
||||
if (!oboy) {
|
||||
qFatal("Cannot find oboy instance.");
|
||||
}
|
||||
Q_ASSERT(oboy->loaded());
|
||||
|
||||
QImage img = oboy->backgroundMap();
|
||||
return img;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue