From 11c63d7ca2ca98a2583bfe59e5cfb8644d85ca54 Mon Sep 17 00:00:00 2001 From: Casper Boemann Date: Tue, 31 Jul 2007 05:24:21 +0000 Subject: [PATCH] Use lates version of button drawing code. Also use the real backgroundcolor - which unfurtunately makes the button look bad because the bg is almost white - more tweaking needed. svn path=/trunk/KDE/kdebase/workspace/; revision=694578 --- clients/oxygen/lib/helper.cpp | 18 ++++++++++++------ clients/oxygen/oxygenbutton.cpp | 4 +++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/clients/oxygen/lib/helper.cpp b/clients/oxygen/lib/helper.cpp index 2c5fe9a6dc..24da167890 100644 --- a/clients/oxygen/lib/helper.cpp +++ b/clients/oxygen/lib/helper.cpp @@ -190,16 +190,22 @@ QPixmap* OxygenHelper::roundButton(const QColor &color, int size) p.setBrush(QBrush(bevelGradient)); p.drawEllipse(QRectF(2.4,2.4,15.2,15.0)); + // inside mask + QRadialGradient maskGradient(10,10,7.4,10,10); + maskGradient.setColorAt(0.75, QColor(0,0,0,0)); + maskGradient.setColorAt(0.90, QColor(0,0,0,140)); + maskGradient.setColorAt(1.00, QColor(0,0,0,255)); + p.setCompositionMode(QPainter::CompositionMode_DestinationIn); + p.setBrush(maskGradient); + p.drawRect(0,0,20,20); + // inside QLinearGradient innerGradient(0, 0, 0, 20); innerGradient.setColorAt(0.0, color); innerGradient.setColorAt(1.0, calcLightColor(color)); - p.setOpacity(0.4); - p.setBrush(QBrush(innerGradient)); - p.drawEllipse(QRectF(3.2,3.2,13.6,13.6)); - p.setOpacity(1.0); - p.setBrush(QBrush(innerGradient)); - p.drawEllipse(QRectF(4.0,4.0,12.0,12.0)); + p.setCompositionMode(QPainter::CompositionMode_DestinationOver); + p.setBrush(innerGradient); + p.drawEllipse(QRectF(2.5,2.5,15.0,14.8)); return pixmap; } diff --git a/clients/oxygen/oxygenbutton.cpp b/clients/oxygen/oxygenbutton.cpp index 06f86cbd80..282aeaa9a2 100644 --- a/clients/oxygen/oxygenbutton.cpp +++ b/clients/oxygen/oxygenbutton.cpp @@ -137,7 +137,9 @@ void OxygenButton::paintEvent(QPaintEvent *) painter.drawPixmap(dx, dy, client_->icon().pixmap(16)); return; } - painter.drawPixmap(0, 0, *globalHelper->roundButton(QColor(240,240,240), BUTTONSIZE)); + + QColor bg = globalHelper->backgroundTopColor(palette().window()); + painter.drawPixmap(0, 0, *globalHelper->roundButton(bg, BUTTONSIZE)); }