diff --git a/widgets/widget.cpp b/widgets/widget.cpp index 5c93fc470..1b8c6cba3 100644 --- a/widgets/widget.cpp +++ b/widgets/widget.cpp @@ -307,9 +307,12 @@ void Widget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW { painter->setOpacity(d->opacity); + /* +NOTE: put this back if we end up needing to control when things paint due to, e.g. zooming. if (!d->shouldPaint(painter, transform())) { return; } + */ if (d->cachePaintMode == NoCacheMode) { paintWidget(painter, option, widget); @@ -318,7 +321,6 @@ void Widget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW // Cached painting QRectF brect = boundingRect(); - QRect boundingRectInt = brect.toRect(); // Fetch the off-screen transparent buffer and exposed area info. QPixmap pix; @@ -375,6 +377,12 @@ void Widget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW QTransform transform = painter->worldTransform(); QRect deviceRect = transform.mapRect(brect).toRect(); + if (deviceRect.width() < 1 || + deviceRect.height() < 1) { + // we have nothing to paint! + return; + } + // Auto-adjust the pixmap size. if (deviceRect.size() != pix.size()) { pix = QPixmap(deviceRect.size());