Qt5OpenGL: fix creating thumbnals, pdf, print preview and snapshot

This commit is contained in:
wmayer
2017-03-12 12:27:20 +01:00
parent a04a7a6b21
commit 67f05c98fa
3 changed files with 20 additions and 8 deletions

View File

@@ -134,9 +134,11 @@ void Thumbnail::RestoreDocFile(Base::Reader &reader)
void Thumbnail::createThumbnailFromFramebuffer(QImage& img) const
{
// Alternative way of off-screen rendering
QtGLFramebufferObject fbo(this->size, this->size,QtGLFramebufferObject::Depth);
if (this->viewer->isActiveWindow()) {
static_cast<QtGLWidget*>(this->viewer->getGLWidget())->makeCurrent();
QtGLFramebufferObject fbo(this->size, this->size,QtGLFramebufferObject::Depth);
this->viewer->renderToFramebuffer(&fbo);
img = fbo.toImage();
static_cast<QtGLWidget*>(this->viewer->getGLWidget())->doneCurrent();
}
}