summaryrefslogtreecommitdiffstats
path: root/src/opengl/qpaintengine_opengl.cpp
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-05-27 12:02:14 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2009-05-27 12:09:40 (GMT)
commit962d216ce9f9f1e6bd73fe43e3d2a7c86f64b75f (patch)
tree9fccf497be456fff3cfde4d5b0d0ea07aae0d7af /src/opengl/qpaintengine_opengl.cpp
parent71cb35e942b94e4dba2055acdebbf90c352da762 (diff)
downloadQt-962d216ce9f9f1e6bd73fe43e3d2a7c86f64b75f.zip
Qt-962d216ce9f9f1e6bd73fe43e3d2a7c86f64b75f.tar.gz
Qt-962d216ce9f9f1e6bd73fe43e3d2a7c86f64b75f.tar.bz2
Make QGLWidgets have the same background colour as QWidgets
QWidgets are filled with Qt::transparent when WA_TranslucentBackground is set, reguardless of what their background colour has been set to. This patch makes QGLWidgets behave the same way. Reviewed-By: Samuel Rødal
Diffstat (limited to 'src/opengl/qpaintengine_opengl.cpp')
-rw-r--r--src/opengl/qpaintengine_opengl.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index d5bf1dc..e3d8a1d 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -1330,9 +1330,15 @@ bool QOpenGLPaintEngine::begin(QPaintDevice *pdev)
d->offscreen.begin();
- const QColor &c = d->drawable.backgroundColor();
- glClearColor(c.redF(), c.greenF(), c.blueF(), d->drawable.format().alpha() ? c.alphaF() : 1.0);
if (d->drawable.context()->d_func()->clear_on_painter_begin && d->drawable.autoFillBackground()) {
+
+ if (d->drawable.hasTransparentBackground())
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ else {
+ const QColor &c = d->drawable.backgroundColor();
+ glClearColor(c.redF(), c.greenF(), c.blueF(), 1.0);
+ }
+
GLbitfield clearBits = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT;
#ifndef QT_OPENGL_ES
clearBits |= GL_ACCUM_BUFFER_BIT;