src/gui/painting/qwindowsurface_qws.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
--- a/src/gui/painting/qwindowsurface_qws.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/gui/painting/qwindowsurface_qws.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -80,7 +80,7 @@
 
 inline bool isWidgetOpaque(const QWidget *w)
 {
-    return w->d_func()->isOpaque;
+    return w->d_func()->isOpaque && !w->testAttribute(Qt::WA_TranslucentBackground);
 }
 
 static inline QScreen *getScreen(const QWidget *w)
@@ -873,6 +873,21 @@
     return true;
 }
 
+// ### copied from qwindowsurface_raster.cpp -- should be cross-platform
+void QWSMemorySurface::beginPaint(const QRegion &rgn)
+{
+    if (!isWidgetOpaque(window())) {
+        QPainter p(&img);
+        p.setCompositionMode(QPainter::CompositionMode_Source);
+        const QVector<QRect> rects = rgn.rects();
+        const QColor blank = Qt::transparent;
+        for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
+            p.fillRect(*it, blank);
+        }
+    }
+    QWSWindowSurface::beginPaint(rgn);
+}
+
 // from qwindowsurface.cpp
 extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);