From b850c43896d60b4dda21b01fdbdb15013cca48fa Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 8 Dec 2010 15:45:00 +0100 Subject: Check Qt::WA_TranslucentBackground instead of custom widget property. 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 | 17 +++++------------ .../qmeegographicssystemhelper.cpp | 5 ----- .../qmeegographicssystemhelper.h | 18 ++---------------- 3 files changed, 7 insertions(+), 33 deletions(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index cd9ae01..f64b93c 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -379,19 +379,12 @@ void QGLWindowSurface::hijackWindow(QWidget *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()) { + // For translucent top-level widgets we need alpha in the format. + if (widget->testAttribute(Qt::WA_TranslucentBackground)) { QGLFormat modFormat(surfaceFormat); - - if (widget->property("qglTranslucent").toBool() == true) { - modFormat.setSampleBuffers(false); - modFormat.setSamples(0); - modFormat.setAlpha(true); - } - + modFormat.setSampleBuffers(false); + modFormat.setSamples(0); + modFormat.setAlpha(true); ctx = new QGLContext(modFormat, widget); } else ctx = new QGLContext(surfaceFormat, widget); diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp index 13e44b8..b660eb3 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp @@ -153,8 +153,3 @@ void QMeeGoGraphicsSystemHelper::setTranslucent(bool translucent) ENSURE_RUNNING_MEEGO; QMeeGoRuntime::setTranslucent(translucent); } - -void QMeeGoGraphicsSystemHelper::setTranslucentWidget(QWidget w, bool translucent) -{ - w.setProperty("qglTranslucent", QVariant(translucent)); -} diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h index 3e1333d..6df3c22 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h @@ -182,24 +182,10 @@ public: When called with true, the base window surface will be translucent and initialized with QGLFormat.alpha == true. - This function is *deprecated*. Use ::setTranslucentWidget instead. + This function is *deprecated*. Set Qt::WA_TranslucentBackground attribute + on the top-level widget *before* you show it instead. */ static void setTranslucent(bool translucent); - - //! Sets translucency (alpha) on the given top-level widget. - /*! - This is a new API for enabling GL translucency on top-level widgets. - The specified widget needs to be top-level. When the time comes to create - a window surface for the widget, it'll be created with translucency enabled - (if translucent is true). - - This function has no effect if the widget is already visible or if it's - not a top-level widget. - - This function can be called even if not running MeeGo graphics system. It'll - have no effect though. - */ - static void setTranslucentWidget(QWidget w, bool translucent); }; #endif -- cgit v0.12