From 5c3c0d477104f6f4eafaceeacac8278c4b97f8cc Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 22 Sep 2009 16:50:28 +0200 Subject: Fixed background gradients in ObjectBoundingMode Reviewed-by: Samuel --- src/gui/kernel/qwidget.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index e68a72d..6f5781c 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2106,6 +2106,13 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); } #endif // Q_WS_MAC + + } else if (brush.gradient() + && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) { + painter->save(); + painter->setClipRegion(rgn); + 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) @@ -2146,7 +2153,6 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int if (q->autoFillBackground()) fillRegion(painter, rgn, autoFillBrush); - if (q->testAttribute(Qt::WA_StyledBackground)) { painter->setClipRegion(rgn); QStyleOption opt; @@ -4991,7 +4997,7 @@ QGraphicsEffect *QWidget::graphicsEffect() const /*! \brief The setGraphicsEffect function is for setting the widget's graphics effect. - + Sets \a effect as the widget's effect. If there already is an effect installed on this widget, QWidget will delete the existing effect before installing the new \a effect. -- cgit v0.12