diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-09-22 14:50:28 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-09-22 14:51:17 (GMT) |
commit | 5c3c0d477104f6f4eafaceeacac8278c4b97f8cc (patch) | |
tree | 0f51750db88bb9cd92b9ea4daef5d47b701f0745 /src | |
parent | 1931c3e4cb502ba1d7461129bcc6f3c9ee600f9c (diff) | |
download | Qt-5c3c0d477104f6f4eafaceeacac8278c4b97f8cc.zip Qt-5c3c0d477104f6f4eafaceeacac8278c4b97f8cc.tar.gz Qt-5c3c0d477104f6f4eafaceeacac8278c4b97f8cc.tar.bz2 |
Fixed background gradients in ObjectBoundingMode
Reviewed-by: Samuel
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 10 |
1 files 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<QRect> &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. |