summaryrefslogtreecommitdiffstats
path: root/src/gui/styles
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-08-12 15:41:11 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-08-12 16:32:02 (GMT)
commit0c992f560a0872ccdc4a44cf4d1c7da627cc6807 (patch)
treeabdef86516e0bb594eba7f60b23ed2b51a2c8a33 /src/gui/styles
parent77feedfa3c00dc39df65bd4f567c9d43e8e25b4f (diff)
downloadQt-0c992f560a0872ccdc4a44cf4d1c7da627cc6807.zip
Qt-0c992f560a0872ccdc4a44cf4d1c7da627cc6807.tar.gz
Qt-0c992f560a0872ccdc4a44cf4d1c7da627cc6807.tar.bz2
Ugly round corners when no border is drawn
When specifying round corners with QStyleSheetStyle and no border-width specified, the round corners were not rendered with antialiasing. Furthermore, if border-width was set to 0, part of the border was rendered in discordance with CSS3. The background in now rendered directly instead of drawing a clipped rectangle. The actual border width is checked before rendering. A test has been added at tests/auto/uiloader/baseline/css_borderradius_allwidgets.ui Task-number: 230362 Reviewed-by: olivier
Diffstat (limited to 'src/gui/styles')
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 370290f..8ac811c 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -1298,7 +1298,6 @@ void QRenderRule::unsetClip(QPainter *p)
void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& off)
{
- setClip(p, borderRect(rect));
QBrush brush = hasBackground() ? background()->brush : QBrush();
if (brush.style() == Qt::NoBrush)
brush = defaultBackground;
@@ -1306,11 +1305,19 @@ void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& o
if (brush.style() != Qt::NoBrush) {
Origin origin = hasBackground() ? background()->clip : Origin_Border;
// ### fix for gradients
- p->fillRect(originRect(rect, origin), brush);
+ const QPainterPath &borderPath = borderClip(originRect(rect, origin));
+ if (!borderPath.isEmpty()) {
+ // Drawn intead of being used as clipping path for better visual quality
+ bool wasAntialiased = p->renderHints() & QPainter::Antialiasing;
+ p->setRenderHint(QPainter::Antialiasing);
+ p->fillPath(borderPath, brush);
+ p->setRenderHint(QPainter::Antialiasing, wasAntialiased);
+ } else {
+ p->fillRect(originRect(rect, origin), brush);
+ }
}
drawBackgroundImage(p, rect, off);
- unsetClip(p);
}
void QRenderRule::drawFrame(QPainter *p, const QRect& rect)