rendered paste bodyIndex: widget.cpp
===================================================================
--- widget.cpp (revision 722701)
+++ widget.cpp (working copy)
@@ -325,6 +325,7 @@
// Recreate the pixmap if it's gone.
if (pix.isNull()) {
pix = QPixmap(d->cacheSize);
+ pix.fill(Qt::transparent);
exposed = brect;
}
@@ -336,17 +337,11 @@
cacheOption.exposedRect = exposed.toRect(); // <- truncation
QPainter pixmapPainter(&pix);
-
// Fit the item's bounding rect into the pixmap's coordinates.
pixmapPainter.scale(pix.width() / brect.width(),
- pix.height() / brect.height());
+ pix.height() / brect.height());
pixmapPainter.translate(-brect.topLeft());
- // erase the exposed area so we don't paint over and over
- pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source);
- pixmapPainter.fillRect(exposed, Qt::transparent);
- pixmapPainter.setCompositionMode(QPainter::CompositionMode_SourceOver);
-
// Re-render the invalidated areas of the pixmap. Important: don't
// fool the item into using the widget - pass 0 instead of \a
// widget.
@@ -372,6 +367,7 @@
// Auto-adjust the pixmap size.
if (deviceRect.size() != pix.size()) {
pix = QPixmap(deviceRect.size());
+ pix.fill(Qt::transparent);
exposed = brect;
}
@@ -388,16 +384,9 @@
// Transform the painter, and render the item in device coordinates.
QPainter pixmapPainter(&pix);
-
pixmapPainter.translate(offset);
pixmapPainter.setWorldTransform(transform, true);
pixmapPainter.translate(transform.inverted().map(QPointF(0, 0)));
-
- // erase the exposed area so we don't paint over and over
- pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source);
- pixmapPainter.fillRect(exposed, Qt::transparent);
- pixmapPainter.setCompositionMode(QPainter::CompositionMode_SourceOver);
-
paintWidget(&pixmapPainter, &cacheOption, 0);
pixmapPainter.end();