Window can have a transparent/translucent color
authorShawn Rutledge <shawn.rutledge@digia.com>
Tue, 29 Jan 2013 11:53:41 +0000 (12:53 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 30 Jan 2013 23:27:11 +0000 (00:27 +0100)
Change-Id: I1e39b8537dfa00a327b6c735336872cf302c3229
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
src/quick/items/qquickwindow.cpp

index bf82423..086865a 100644 (file)
@@ -2815,6 +2815,14 @@ void QQuickWindow::setColor(const QColor &color)
     if (color == d->clearColor)
         return;
 
+    if (color.alpha() != d->clearColor.alpha()) {
+        QSurfaceFormat fmt = format();
+        if (color.alpha() < 255)
+            fmt.setAlphaBufferSize(8);
+        else
+            fmt.setAlphaBufferSize(-1);
+        setFormat(fmt);
+    }
     d->clearColor = color;
     emit colorChanged(color);
     d->dirtyItem(contentItem());