diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 1e9d5addc..64d56c61b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1687,9 +1687,13 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush); painter->restore(); } else { - const QVector &rects = rgn.rects(); - for (int i = 0; i < rects.size(); ++i) - painter->fillRect(rects.at(i), brush); + QPen oldPen = painter->pen(); + QBrush oldBrush = painter->brush(); + painter->setPen(Qt::NoPen); + painter->setBrush(brush); + painter->drawRects(rgn.rects()); + painter->setBrush(oldBrush); + painter->setPen(oldPen); } } @@ -1715,8 +1719,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int const QBrush autoFillBrush = q->palette().brush(q->backgroundRole()); if ((flags & DrawAsRoot) && !(q->autoFillBackground() && autoFillBrush.isOpaque())) { - const QBrush bg = q->palette().brush(QPalette::Window); - fillRegion(painter, rgn, bg); + fillRegion(painter, rgn, q->palette().brush(QPalette::Window)); } if (q->autoFillBackground()) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index f46a54c59..ef02265fb 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -1256,28 +1256,29 @@ void QWidgetPrivate::updateSystemBackground() || q->testAttribute(Qt::WA_NoSystemBackground) || q->testAttribute(Qt::WA_UpdatesDisabled) || type == Qt::Popup || type == Qt::ToolTip) { - if (QX11Info::isCompositingManagerRunning() - && q->testAttribute(Qt::WA_TranslucentBackground) - && !(q->parent())) - XSetWindowBackground(qt_x11Data->display, q->internalWinId(), - QX11Data::XColorPixel(xinfo.screen(), Qt::transparent)); - else - XSetWindowBackgroundPixmap(qt_x11Data->display, q->internalWinId(), XNone); + if (QX11Info::isCompositingManagerRunning() + && q->testAttribute(Qt::WA_TranslucentBackground) + && !(q->parent())) { + XSetWindowBackground(qt_x11Data->display, q->internalWinId(), + QX11Data::XColorPixel(xinfo.screen(), Qt::transparent)); + } else { + XSetWindowBackgroundPixmap(qt_x11Data->display, q->internalWinId(), XNone); } - else if (brush.style() == Qt::SolidPattern && brush.isOpaque()) + } else if (brush.style() == Qt::SolidPattern && brush.isOpaque()) { XSetWindowBackground(qt_x11Data->display, q->internalWinId(), QX11Data::XColorPixel(xinfo.screen(), brush.color())); - else if (isBackgroundInherited()) + } else if (isBackgroundInherited()) { XSetWindowBackgroundPixmap(qt_x11Data->display, q->internalWinId(), ParentRelative); - else if (brush.style() == Qt::TexturePattern) { + } else if (brush.style() == Qt::TexturePattern) { const Qt::HANDLE bgpixmap = brush.texture().toX11Pixmap(); XSetWindowBackgroundPixmap(qt_x11Data->display, q->internalWinId(), bgpixmap); if (bgpixmap) { XFreePixmap(qt_x11Data->display, bgpixmap); } - } else + } else { XSetWindowBackground(qt_x11Data->display, q->internalWinId(), QX11Data::XColorPixel(xinfo.screen(), brush.color())); + } } #ifndef QT_NO_CURSOR