[Interest] QWindow::setTransientParent()

Agocs Laszlo laszlo.agocs at theqtcompany.com
Tue Nov 25 10:00:21 CET 2014


Hi John,

Right. grabFramebuffer() won't suffice since you need to specify a custom size. So use your own QOpenGLFramebufferObject with the desired size and then call toImage(), similarly to this:

w.makeCurrent(); // w is a QOpenGLWidget
QOpenGLFramebufferObject fbo(size, QOpenGLFramebufferObject::CombinedDepthStencil);
fbo.bind();
... // draw
fbo.release();
img = fbo.toImage();

Cheers,
Laszlo

________________________________________
From: interest-bounces+laszlo.agocs=theqtcompany.com at qt-project.org <interest-bounces+laszlo.agocs=theqtcompany.com at qt-project.org> on behalf of John Weeks <john at wavemetrics.com>
Sent: Monday, November 24, 2014 6:12 PM
To: interest
Subject: Re: [Interest] QWindow::setTransientParent()

> renderPixmap() can be replaced with a call to grabFramebuffer(). They both perform (potentially expensive) readbacks.

Thanks Laszlo.

The expense is probably OK, since this is for exporting graphics as a file or on the clipboard. But grabFramebuffer() gives you the same resolution as on screen, and we need hi-res export.

I ran across some code in a JIRA bug using QGLFramebufferObject; I see there is also QOpenGLFramebufferObject so I guess we can use the same technique.

-John Weeks

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list