From f317d94880554a114937554907d08807c0cf5047 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 8 Dec 2010 13:48:22 +0100 Subject: Support for 'qglTranslucent' in QGLWindowSurface. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2523 Reviewed-by: Samuel Rødal --- src/opengl/qwindowsurface_gl.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index bbb98d0..cd9ae01 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -377,7 +377,25 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) if (widgetPrivate->extraData()->glContext) return; - QGLContext *ctx = new QGLContext(surfaceFormat, widget); + QGLContext *ctx = NULL; + + // Inspect the 'qglTranslucent' property of the target widget. If set to true, + // we need to create the surface in a 32bit alpha-compatible format. This is + // currently used by MeeGo graphics system extra API's. Could be in future + // used by other platform-specific graphic system API's. + if (widget->property("qglTranslucent").isValid()) { + QGLFormat modFormat(surfaceFormat); + + if (widget->property("qglTranslucent").toBool() == true) { + modFormat.setSampleBuffers(false); + modFormat.setSamples(0); + modFormat.setAlpha(true); + } + + ctx = new QGLContext(modFormat, widget); + } else + ctx = new QGLContext(surfaceFormat, widget); + ctx->create(qt_gl_share_widget()->context()); #ifndef QT_NO_EGL -- cgit v0.12