Fix 'Export as Image' in retina mode.

QGLWidget::grabFrameBuffer() doesn't do the right thing if it's tricked
into retina mode.

Most of the code in this patch was taken from Qt's qgl.cpp.