diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 35f6298..25289f8 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -4336,7 +4336,7 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &
         if (!pixmapExposed.isEmpty()) {
             // Applied to subPix; paint is adjusted to the coordinate space is
             // correct.
-            pixmapPainter.setClipRegion(pixmapExposed);
+            pixmapPainter.setClipRegion(pixmapExposed, Qt::IntersectClip);
         }
     }
 
@@ -4352,7 +4352,7 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &
         // Blit the subpixmap into the main pixmap.
         pixmapPainter.begin(pix);
         pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source);
-        pixmapPainter.setClipRegion(pixmapExposed);
+        pixmapPainter.setClipRegion(pixmapExposed, Qt::IntersectClip);
         pixmapPainter.drawPixmap(br.topLeft(), subPix);
         pixmapPainter.end();
     }
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 9d74123..8239085 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -2205,7 +2205,7 @@ void QGraphicsView::render(QPainter *painter, const QRectF &target, const QRect
     painter->save();
 
     // Clip in device coordinates to avoid QRegion transformations.
-    painter->setClipRect(targetRect);
+    painter->setClipRect(targetRect, Qt::IntersectClip);
     QPainterPath path;
     path.addPolygon(sourceScenePoly);
     path.closeSubpath();
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index 6a6220c..f116179 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -371,7 +371,7 @@ void QItemDelegate::paint(QPainter *painter,
     // prepare
     painter->save();
     if (d->clipPainting)
-        painter->setClipRect(opt.rect);
+        painter->setClipRect(opt.rect, Qt::IntersectClip);
 
     // get the data and the rectangles
 
@@ -664,7 +664,7 @@ void QItemDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem &o
     if (!hasClipping() && (textRect.width() < textLayoutSize.width()
                            || textRect.height() < textLayoutSize.height())) {
         painter->save();
-        painter->setClipRect(layoutRect);
+        painter->setClipRect(layoutRect, Qt::IntersectClip);
         d->textLayout.draw(painter, layoutRect.topLeft(), QVector<QTextLayout::FormatRange>(), layoutRect);
         painter->restore();
     } else {
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index b799323..424a7b2 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -847,7 +847,7 @@ void QTableViewPrivate::drawAndClipSpans(const QRegion &area, QPainter *painter,
         }
 
     }
-    painter->setClipRegion(region);
+    painter->setClipRegion(region, Qt::IntersectClip);
 }
 
 /*!
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index c1647cc..3fc542a 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1732,7 +1732,7 @@ void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option,
             const bool setClipRect = branches.width() > width;
             if (setClipRect) {
                 painter->save();
-                painter->setClipRect(QRect(position, y, width, height));
+                painter->setClipRect(QRect(position, y, width, height), Qt::IntersectClip);
             }
             // draw background for the branch (selection + alternate row)
             opt.rect = branches;
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 4286019..231b0ce 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -327,7 +327,7 @@ void QWhatsThat::paintEvent(QPaintEvent*)
         p.translate(r.x(), r.y());
         QRect rect = r;
         rect.translate(-r.x(), -r.y());
-        p.setClipRect(rect);
+        p.setClipRect(rect, Qt::IntersectClip);
         QAbstractTextDocumentLayout::PaintContext context;
         context.palette.setBrush(QPalette::Text, context.palette.toolTipText());
         doc->documentLayout()->draw(&p, context);
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index f467bcf..a80536e 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -2407,7 +2407,7 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus
 #else
         {
             const QRect rect(rgn.boundingRect());
-            painter->setClipRegion(rgn);
+            painter->setClipRegion(rgn, Qt::IntersectClip);
             painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
         }
 #endif
@@ -2415,7 +2415,7 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus
     } else if (brush.gradient()
                && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) {
         painter->save();
-        painter->setClipRegion(rgn);
+        painter->setClipRegion(rgn, Qt::IntersectClip);
         painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush);
         painter->restore();
     } else {
@@ -2462,7 +2462,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
         fillRegion(painter, rgn, autoFillBrush);
 
     if (q->testAttribute(Qt::WA_StyledBackground)) {
-        painter->setClipRegion(rgn);
+        painter->setClipRegion(rgn, Qt::IntersectClip);
         QStyleOption opt;
         opt.initFrom(q);
         q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q);
@@ -5681,7 +5681,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
             QPaintEngine *engine = pdev->paintEngine();
             if (engine) {
                 QPainter p(pdev);
-                p.setClipRegion(toBePainted);
+                p.setClipRegion(toBePainted, Qt::IntersectClip);
                 const QBrush bg = q->palette().brush(QPalette::Window);
                 if (bg.style() == Qt::TexturePattern)
                     p.drawTiledPixmap(q->rect(), bg.texture());
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 781ad96..5d3a85b 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -216,7 +216,7 @@ void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePa
         pe->setSystemClip(paintRegion);
         {
             QPainter p(widget);
-            p.setClipRegion(paintRegion);
+            p.setClipRegion(paintRegion, Qt::IntersectClip);
             static int i = 0;
             switch (i) {
             case 0:
diff --git a/src/widgets/styles/qandroidstyle.cpp b/src/widgets/styles/qandroidstyle.cpp
index 110153d..46ac384 100644
--- a/src/widgets/styles/qandroidstyle.cpp
+++ b/src/widgets/styles/qandroidstyle.cpp
@@ -427,7 +427,7 @@ void QAndroidStyle::drawComplexControl(ComplexControl cc,
                     }
                     region -= finalRect;
                 }
-                p->setClipRegion(region);
+                p->setClipRegion(region, Qt::IntersectClip);
                 drawPrimitive(PE_FrameGroupBox, &frame, p, widget);
                 p->restore();
             }
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index afcb50c..c25960a 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -2018,7 +2018,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
             QRect r = opt->rect;
             QStyleHintReturnMask mask;
             if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
-                p->setClipRegion(mask.region);
+                p->setClipRegion(mask.region, Qt::IntersectClip);
             p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap);
             p->setPen(opt->palette.color(QPalette::Active, QPalette::WindowText));
             p->setBrush(Qt::NoBrush);
@@ -2065,7 +2065,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
     case CE_Header:
         if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
             QRegion clipRegion = p->clipRegion();
-            p->setClipRect(opt->rect);
+            p->setClipRect(opt->rect, Qt::IntersectClip);
             proxy()->drawControl(CE_HeaderSection, header, p, widget);
             QStyleOptionHeader subopt = *header;
             subopt.rect = subElementRect(SE_HeaderLabel, header, widget);
@@ -2075,7 +2075,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
                 subopt.rect = subElementRect(SE_HeaderArrow, opt, widget);
                 proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, p, widget);
             }
-            p->setClipRegion(clipRegion);
+            p->setClipRegion(clipRegion, Qt::IntersectClip);
         }
         break;
     case CE_FocusFrame:
@@ -2094,7 +2094,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
         if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
             QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
             p->save();
-            p->setClipRect(editRect);
+            p->setClipRect(editRect, Qt::IntersectClip);
             if (!cb->currentIcon.isNull()) {
                 QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
                                                              : QIcon::Disabled;
@@ -2165,7 +2165,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
     case CE_ItemViewItem:
         if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
             p->save();
-            p->setClipRect(opt->rect);
+            p->setClipRect(opt->rect, Qt::IntersectClip);
 
             QRect checkRect = proxy()->subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget);
             QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, vopt, widget);
@@ -3695,7 +3695,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
                     }
                     region -= finalRect;
                 }
-                p->setClipRegion(region);
+                p->setClipRegion(region, Qt::IntersectClip);
                 proxy()->drawPrimitive(PE_FrameGroupBox, &frame, p, widget);
                 p->restore();
             }
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index dc703e3..fa0b240 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -469,7 +469,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
                 QRegion region(tbb->rect);
                 region -= tbb->selectedTabRect;
                 painter->drawLine(tbb->rect.topLeft(), tbb->rect.topRight());
-                painter->setClipRegion(region);
+                painter->setClipRegion(region, Qt::IntersectClip);
                 painter->setPen(option->palette.light().color());
                 painter->drawLine(tbb->rect.topLeft() + QPoint(0, 1), tbb->rect.topRight() + QPoint(0, 1));
             }
@@ -1020,7 +1020,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
         if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
             QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
             painter->save();
-            painter->setClipRect(editRect);
+            painter->setClipRect(editRect, Qt::IntersectClip);
             if (!cb->currentIcon.isNull()) {
                 QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
                                                              : QIcon::Disabled;
@@ -1420,7 +1420,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
 
                 painter->save();
                 if (!complete && !indeterminate)
-                    painter->setClipRect(progressBar.adjusted(-1, -1, -1, 1));
+                    painter->setClipRect(progressBar.adjusted(-1, -1, -1, 1), Qt::IntersectClip);
                 QRect fillRect = progressBar.adjusted( !indeterminate && !complete && reverse ? -2 : 0, 0,
                                                        indeterminate || complete || reverse ? 0 : 2, 0);
                 painter->drawRoundedRect(fillRect, 2, 2);
@@ -1437,7 +1437,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
                 } else {
                     highlightedGradientStartColor.setAlpha(120);
                     painter->setPen(QPen(highlightedGradientStartColor, 9.0));
-                    painter->setClipRect(progressBar.adjusted(1, 1, -1, -1));
+                    painter->setClipRect(progressBar.adjusted(1, 1, -1, -1), Qt::IntersectClip);
 #ifndef QT_NO_ANIMATION
                 if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(option->styleObject)))
                     step = animation->animationStep() % 22;
@@ -1478,12 +1478,12 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
 
             QRegion rightRect = rect;
             rightRect = rightRect.subtracted(leftRect);
-            painter->setClipRegion(rightRect);
+            painter->setClipRegion(rightRect, Qt::IntersectClip);
             painter->setPen(flip ? alternateTextColor : textColor);
             painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
             if (!leftRect.isNull()) {
                 painter->setPen(flip ? textColor : alternateTextColor);
-                painter->setClipRect(leftRect);
+                painter->setClipRect(leftRect, Qt::IntersectClip);
                 painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
             }
             painter->restore();
@@ -1911,7 +1911,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
             QRect drawRect = rect.adjusted(0, selected ? 0 : 2, 0, 3);
             painter->setPen(outlinePen);
             painter->save();
-            painter->setClipRect(rect.adjusted(-1, -1, 1, selected ? -2 : -3));
+            painter->setClipRect(rect.adjusted(-1, -1, 1, selected ? -2 : -3), Qt::IntersectClip);
             painter->setBrush(fillGradient);
             painter->drawRoundedRect(drawRect.adjusted(0, 0, -1, -1), 2.0, 2.0);
             painter->setBrush(Qt::NoBrush);
@@ -2071,7 +2071,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
                     cachePainter.setBrush(gradient);
 
                     cachePainter.save();
-                    cachePainter.setClipRect(updownRect);
+                    cachePainter.setClipRect(updownRect, Qt::IntersectClip);
                     cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2);
                     cachePainter.setPen(QPen(d->innerContrastLine()));
                     cachePainter.setBrush(Qt::NoBrush);
@@ -2353,7 +2353,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
                     QRegion clipRegion = backWindowRect;
                     clipRegion -= frontWindowRect;
                     painter->save();
-                    painter->setClipRegion(clipRegion);
+                    painter->setClipRegion(clipRegion, Qt::IntersectClip);
                     painter->setPen(textColor);
                     painter->drawRect(backWindowRect.adjusted(0, 0, -1, -1));
                     painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1,
@@ -2599,7 +2599,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
                 subtleEdge.setAlpha(40);
                 painter->setPen(subtleEdge);
                 painter->setBrush(Qt::NoBrush);
-                painter->setClipRect(scrollBarGroove.adjusted(1, 0, -1, -3));
+                painter->setClipRect(scrollBarGroove.adjusted(1, 0, -1, -3), Qt::IntersectClip);
                 painter->drawRect(scrollBarGroove.adjusted(1, 0, -1, -1));
                 painter->restore();
             }
@@ -2787,7 +2787,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
 
                     // Draw button clipped
                     cachePainter.save();
-                    cachePainter.setClipRect(downArrowRect.adjusted(0, 0, 1, 0));
+                    cachePainter.setClipRect(downArrowRect.adjusted(0, 0, 1, 0), Qt::IntersectClip);
                     buttonOption.rect.setLeft(comboBox->direction == Qt::LeftToRight ?
                                                   downArrowRect.left() - 6: downArrowRect.right() + 6);
                     proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget);
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 8d0fe11..d6fd8a0 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -2164,7 +2164,7 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush
     if (!usePainter && qt_mac_backgroundPattern
         && qt_mac_backgroundPattern->cacheKey() == brush.texture().cacheKey()) {
 
-        painter->setClipRegion(rgn);
+        painter->setClipRegion(rgn, Qt::IntersectClip);
 
         QMacCGContext cg(target);
         CGContextSaveGState(cg);
@@ -2181,7 +2181,7 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush
     } else {
 #endif
         const QRect rect(rgn.boundingRect());
-        painter->setClipRegion(rgn);
+        painter->setClipRegion(rgn, Qt::IntersectClip);
         painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
 //    }
 }
@@ -3198,7 +3198,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
             QRegion region(tbb->rect);
             region -= tbb->tabBarRect;
             p->save();
-            p->setClipRegion(region);
+            p->setClipRegion(region, Qt::IntersectClip);
             QStyleOptionTabWidgetFrame twf;
             twf.QStyleOption::operator=(*tbb);
             twf.shape  = tbb->shape;
@@ -5852,7 +5852,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
                     QCFType<HIShapeRef> titleRegion3;
                     HIThemeGetWindowShape(&titleBarRect, &wdi, kWindowTitleTextRgn, &titleRegion3);
                     ptrHIShapeGetBounds(titleRegion3, &tmpRect);
-                    p->setClipRect(qt_qrectForHIRect(tmpRect));
+                    p->setClipRect(qt_qrectForHIRect(tmpRect), Qt::IntersectClip);
                     QRect br = p->clipRegion().boundingRect();
                     int x = br.x(),
                     y = br.y() + (titlebar->rect.height() / 2 - p->fontMetrics().height() / 2);
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 5d977d7..c2b17b6 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3062,7 +3062,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
                 if (!titleRule.hasBackground() || !titleRule.background()->isTransparent()) {
                     clipSet = true;
                     p->save();
-                    p->setClipRegion(QRegion(opt->rect) - titleRect);
+                    p->setClipRegion(QRegion(opt->rect) - titleRect, Qt::IntersectClip);
                 }
             }
 
@@ -3776,7 +3776,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
         if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
             QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, w);
             p->save();
-            p->setClipRect(editRect);
+            p->setClipRect(editRect, Qt::IntersectClip);
             if (!cb->currentIcon.isNull()) {
                 int spacing = rule.hasBox() ? rule.box()->spacing : -1;
                 if (spacing == -1)
@@ -3885,7 +3885,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
         if (subRule.hasDrawable()) {
             if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
                 p->save();
-                p->setClipRect(pb->rect);
+                p->setClipRect(pb->rect, Qt::IntersectClip);
 
                 qint64 minimum = qint64(pb->minimum);
                 qint64 maximum = qint64(pb->maximum);
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index b537931..d9ab301 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -1095,7 +1095,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
             QRect r = opt->rect;
             QStyleHintReturnMask mask;
             if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
-                p->setClipRegion(mask.region);
+                p->setClipRegion(mask.region, Qt::IntersectClip);
             p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap);
             p->restore();
             return;
@@ -1744,7 +1744,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
 
                 if(step > chunkCount - 5)chunksToDraw = (chunkCount - step);
                 p->save();
-                p->setClipRect(m.mapRect(QRectF(rect)).toRect());
+                p->setClipRect(m.mapRect(QRectF(rect)).toRect(), Qt::IntersectClip);
 
                 int x0 = reverse ? rect.left() + rect.width() - unit_width*(step) - unit_width  : rect.left() + unit_width * step;
                 int x = 0;
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 5a53627..b698b24 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -516,7 +516,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
             QRegion clipRegion = option->rect;
             QRegion content = option->rect.adjusted(borderSize, borderSize, -borderSize, -borderSize);
             clipRegion ^= content;
-            painter->setClipRegion(clipRegion);
+            painter->setClipRegion(clipRegion, Qt::IntersectClip);
             d->drawBackground(theme);
             painter->restore();
         } else {
@@ -604,7 +604,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
                 painter->save();
                 QRegion clipRegion = option->rect;
                 clipRegion -= option->rect.adjusted(2, 2, -2, -2);
-                painter->setClipRegion(clipRegion);
+                painter->setClipRegion(clipRegion, Qt::IntersectClip);
                 d->drawBackground(theme);
                 painter->restore();
             }
@@ -1039,7 +1039,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
                     if (animOffset > animationWidth)
                         a->setStartTime(QTime::currentTime());
                     painter->save();
-                    painter->setClipRect(theme.rect);
+                    painter->setClipRect(theme.rect, Qt::IntersectClip);
                     QRect animRect;
                     QSize pixmapSize(14, 14);
                     if (vertical) {
@@ -1115,7 +1115,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
                                                                    //moved out of view
                     }
                     painter->save();
-                    painter->setClipRect(theme.rect);
+                    painter->setClipRect(theme.rect, Qt::IntersectClip);
                     if (vertical) {
                         theme.rect = QRect(theme.rect.left(),
                                            inverted ? rect.top() - glowSize + animOffset :
@@ -1764,7 +1764,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
                             XPThemeData grippBackground = theme;
                             grippBackground.partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
                             theme.rect = gripperBounds;
-                            painter->setClipRegion(d->region(theme));// Only change inside the region of the gripper
+                            painter->setClipRegion(d->region(theme), Qt::IntersectClip);// Only change inside the region of the gripper
                             d->drawBackground(grippBackground);// The gutter is the grippers background
                             d->drawBackground(theme);          // Transparent gripper ontop of background
                             painter->restore();
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index b50c4b6..a500f2e 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -1008,7 +1008,7 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
     if (useRegion) {
         newRegion = region(themeData);
         oldRegion = painter->clipRegion();
-        painter->setClipRegion(newRegion);
+        painter->setClipRegion(newRegion, Qt::IntersectClip);
 #if defined(DEBUG_XP_STYLE) && 0
         printf("Using region:\n");
         for (const QRect &r : newRegion)
@@ -1052,7 +1052,7 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
         if (oldRegion.isEmpty())
             painter->setClipping(false);
         else
-            painter->setClipRegion(oldRegion);
+            painter->setClipRegion(oldRegion, Qt::IntersectClip);
     }
 
     // Cache the pixmap to avoid expensive swapAlphaChannel() calls
@@ -1616,12 +1616,12 @@ case PE_Frame:
                     QRect contentsRect = subElementRect(SE_TabWidgetTabContents, &frameOpt, widget);
                     QRegion reg = option->rect;
                     reg -= contentsRect;
-                    p->setClipRegion(reg);
+                    p->setClipRegion(reg, Qt::IntersectClip);
                     XPThemeData theme(widget, p, themeNumber, partId, stateId, rect);
                     theme.mirrorHorizontally = hMirrored;
                     theme.mirrorVertically = vMirrored;
                     d->drawBackground(theme);
-                    p->setClipRect(contentsRect);
+                    p->setClipRect(contentsRect, Qt::IntersectClip);
                     partId = TABP_BODY;
                 }
             }
@@ -2701,7 +2701,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
                     if (!gripperBounds.isEmpty()) {
                         p->save();
                         theme.rect = gripperBounds;
-                        p->setClipRegion(d->region(theme));// Only change inside the region of the gripper
+                        p->setClipRegion(d->region(theme), Qt::IntersectClip);// Only change inside the region of the gripper
                         d->drawBackground(theme);          // Transparent gripper ontop of background
                         p->restore();
                     }
@@ -2932,7 +2932,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
                     // Draw menu button
                     if ((bflags & State_Sunken) != (mflags & State_Sunken)){
                         p->save();
-                        p->setClipRect(menuarea);
+                        p->setClipRect(menuarea, Qt::IntersectClip);
                         tool.rect = option->rect;
                         proxy()->drawPrimitive(PE_PanelButtonBevel, &tool, p, 0);
                         p->restore();
diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp
index 8b8f4db..bfb5740 100644
--- a/src/widgets/widgets/qfocusframe.cpp
+++ b/src/widgets/widgets/qfocusframe.cpp
@@ -267,7 +267,7 @@ QFocusFrame::paintEvent(QPaintEvent *)
     int hmargin = style()->pixelMetric(QStyle::PM_FocusFrameHMargin);
     QWidgetPrivate *wd = qt_widget_private(d->widget);
     QRect rect = wd->clipRect().adjusted(0, 0, hmargin*2, vmargin*2);
-    p.setClipRect(rect);
+    p.setClipRect(rect, Qt::IntersectClip);
     p.drawControl(QStyle::CE_FocusFrame, option);
 }
 
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index e322580..e82affc 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -1044,7 +1044,7 @@ void QLabel::paintEvent(QPaintEvent *)
 
             painter.save();
             painter.translate(lr.topLeft());
-            painter.setClipRect(lr.translated(-lr.x(), -lr.y()));
+            painter.setClipRect(lr.translated(-lr.x(), -lr.y()), Qt::IntersectClip);
             d->control->setPalette(context.palette);
             d->control->drawContents(&painter, QRectF(), this);
             painter.restore();
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 7e24704..06cce75 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -1892,7 +1892,7 @@ void QLineEdit::paintEvent(QPaintEvent *)
     r.setY(r.y() + d->topTextMargin);
     r.setRight(r.right() - d->effectiveRightTextMargin());
     r.setBottom(r.bottom() - d->bottomTextMargin);
-    p.setClipRect(r);
+    p.setClipRect(r, Qt::IntersectClip);
 
     QFontMetrics fm = fontMetrics();
     Qt::Alignment va = QStyle::visualAlignment(d->control->layoutDirection(), QFlag(d->alignment));
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index a8cdca1..e2631ee 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -3176,7 +3176,7 @@ void QMdiSubWindow::paintEvent(QPaintEvent *paintEvent)
 
     // ### Ensure that we do not require setting the cliprect for 4.4
     if (!isMinimized() && !d->hasBorder(d->cachedStyleOptions))
-        painter.setClipRect(rect().adjusted(0, d->titleBarHeight(d->cachedStyleOptions), 0, 0));
+        painter.setClipRect(rect().adjusted(0, d->titleBarHeight(d->cachedStyleOptions), 0, 0), Qt::IntersectClip);
     if (!isMinimized() || d->hasBorder(d->cachedStyleOptions))
         painter.drawPrimitive(QStyle::PE_FrameWindow, frameOptions);
 }
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 5732131..147b6b0 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -880,7 +880,7 @@ void QMenuPrivate::drawScroller(QPainter *painter, QMenuPrivate::ScrollerTearOff
     if (type == QMenuPrivate::ScrollerTearOffItem::ScrollDown)
         menuOpt.state |= QStyle::State_DownArrow;
 
-    painter->setClipRect(menuOpt.rect);
+    painter->setClipRect(menuOpt.rect, Qt::IntersectClip);
     q->style()->drawControl(QStyle::CE_MenuScroller, &menuOpt, painter, q);
 }
 
@@ -904,7 +904,7 @@ void QMenuPrivate::drawTearOff(QPainter *painter, const QRect &rect)
     if (tearoffHighlighted)
         menuOpt.state |= QStyle::State_Selected;
 
-    painter->setClipRect(menuOpt.rect);
+    painter->setClipRect(menuOpt.rect, Qt::IntersectClip);
     q->style()->drawControl(QStyle::CE_MenuTearoff, &menuOpt, painter, q);
 }
 
@@ -2745,7 +2745,7 @@ void QMenu::paintEvent(QPaintEvent *e)
         }
 
         QRegion adjustedActionReg(adjustedActionRect);
-        p.setClipRegion(adjustedActionReg);
+        p.setClipRegion(adjustedActionReg, Qt::IntersectClip);
 
         QStyleOptionMenuItem opt;
         initStyleOption(&opt, action);
@@ -2776,7 +2776,7 @@ void QMenu::paintEvent(QPaintEvent *e)
         borderReg += QRect(width()-fw, 0, fw, height()); //right
         borderReg += QRect(0, 0, width(), fw); //top
         borderReg += QRect(0, height()-fw, width(), fw); //bottom
-        p.setClipRegion(borderReg);
+        p.setClipRegion(borderReg, Qt::IntersectClip);
         emptyArea -= borderReg;
         QStyleOptionFrame frame;
         frame.rect = rect();
@@ -2788,7 +2788,7 @@ void QMenu::paintEvent(QPaintEvent *e)
     }
 
     //finally the rest of the spaces
-    p.setClipRegion(emptyArea);
+    p.setClipRegion(emptyArea, Qt::IntersectClip);
     menuOpt.state = QStyle::State_None;
     menuOpt.menuItemType = QStyleOptionMenuItem::EmptyArea;
     menuOpt.checkType = QStyleOptionMenuItem::NotCheckable;
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index c16b2a5..16fa81c 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -955,7 +955,7 @@ void QMenuBar::paintEvent(QPaintEvent *e)
         QStyleOptionMenuItem opt;
         initStyleOption(&opt, action);
         opt.rect = adjustedActionRect;
-        p.setClipRect(adjustedActionRect);
+        p.setClipRect(adjustedActionRect, Qt::IntersectClip);
         style()->drawControl(QStyle::CE_MenuBarItem, &opt, &p, this);
     }
      //draw border
@@ -965,7 +965,7 @@ void QMenuBar::paintEvent(QPaintEvent *e)
         borderReg += QRect(width()-fw, 0, fw, height()); //right
         borderReg += QRect(0, 0, width(), fw); //top
         borderReg += QRect(0, height()-fw, width(), fw); //bottom
-        p.setClipRegion(borderReg);
+        p.setClipRegion(borderReg, Qt::IntersectClip);
         emptyArea -= borderReg;
         QStyleOptionFrame frame;
         frame.rect = rect();
@@ -975,7 +975,7 @@ void QMenuBar::paintEvent(QPaintEvent *e)
         frame.midLineWidth = 0;
         style()->drawPrimitive(QStyle::PE_PanelMenuBar, &frame, &p, this);
     }
-    p.setClipRegion(emptyArea);
+    p.setClipRegion(emptyArea, Qt::IntersectClip);
     QStyleOptionMenuItem menuOpt;
     menuOpt.palette = palette();
     menuOpt.state = QStyle::State_None;
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 746dc20..78dde00 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -1901,7 +1901,7 @@ void QPlainTextEdit::paintEvent(QPaintEvent *e)
     int maxX = offset.x() + qMax((qreal)viewportRect.width(), maximumWidth)
                - document()->documentMargin();
     er.setRight(qMin(er.right(), maxX));
-    painter.setClipRect(er);
+    painter.setClipRect(er, Qt::IntersectClip);
 
 
     QAbstractTextDocumentLayout::PaintContext context = getPaintContext();
