1
0
Fork 0

Add missing code to previous commit :)

This commit is contained in:
James Turner 2020-06-05 20:49:05 +01:00
parent a9e5a27e55
commit 033a53f1d7
2 changed files with 12 additions and 5 deletions

View file

@ -468,6 +468,12 @@ QQuickDrawable::QQuickDrawable() : d(new QQuickDrawablePrivate)
}
}
QQuickDrawable::~QQuickDrawable()
{
delete d->qmlEngine;
delete d->renderControl;
}
void QQuickDrawable::setup(osgViewer::GraphicsWindow *gw, osgViewer::Viewer *viewer)
{
osg::GraphicsContext* gc = gw;
@ -514,12 +520,12 @@ void QQuickDrawable::setup(osgViewer::GraphicsWindow *gw, osgViewer::Viewer *vie
d->renderControl->prepareThread(op->thread());
#endif
QObject::connect(d->renderControl, &QQuickRenderControl::sceneChanged,
d, &QQuickDrawablePrivate::onSceneChanged);
d.get(), &QQuickDrawablePrivate::onSceneChanged);
QObject::connect(d->renderControl, &QQuickRenderControl::renderRequested,
d, &QQuickDrawablePrivate::onRenderRequested);
d.get(), &QQuickDrawablePrivate::onRenderRequested);
viewer->getEventHandlers().push_front(new QuickEventHandler(d));
viewer->getEventHandlers().push_front(new QuickEventHandler(d.get()));
}
void QQuickDrawable::drawImplementation(osg::RenderInfo& renderInfo) const
@ -557,7 +563,7 @@ void QQuickDrawable::setSource(QUrl url)
d->qmlComponent = new QQmlComponent(d->qmlEngine, url);
if (d->qmlComponent->isLoading()) {
QObject::connect(d->qmlComponent, &QQmlComponent::statusChanged,
d, &QQuickDrawablePrivate::onComponentLoaded);
d.get(), &QQuickDrawablePrivate::onComponentLoaded);
} else {
d->onComponentLoaded();
}

View file

@ -19,6 +19,7 @@
#ifndef FG_VIEWER_QUICK_DRAWABLE_HXX
#define FG_VIEWER_QUICK_DRAWABLE_HXX
#include <memory>
#include <osg/Drawable>
#include <QUrl>
@ -50,7 +51,7 @@ public:
void resize(int width, int height);
private:
QQuickDrawablePrivate* d;
std::unique_ptr<QQuickDrawablePrivate> d;
};
#endif