From 313bc152f20d3b30116504bed55c26551adf66e5 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Sat, 29 Aug 2009 20:25:21 +0000 Subject: [PATCH] fixed button rendering using QPainterPath, as done for kde2 windeco svn path=/trunk/KDE/kdebase/workspace/; revision=1017171 --- clients/laptop/laptopclient.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/clients/laptop/laptopclient.cpp b/clients/laptop/laptopclient.cpp index 7f27ab17e5..ee8b64afa9 100644 --- a/clients/laptop/laptopclient.cpp +++ b/clients/laptop/laptopclient.cpp @@ -338,10 +338,16 @@ void LaptopButton::drawButton(QPainter *p) p->drawLine(0, h-1, w-1, h-1); } - p->setPen(btnForeground); - int xOff = (width()-8)/2; - int yOff = (height()-8)/2; - p->drawPixmap(isDown() ? xOff+1: xOff, isDown() ? yOff+1 : yOff, deco); + QPainterPath path; + path.addRegion( deco ); + + QPoint offset( (width()-8)/2, (height()-8)/2 ); + if( isDown() ) offset += QPoint( 1, 1 ); + p->translate( offset ); + p->setPen( Qt::NoPen ); + p->setBrush( btnForeground ); + p->drawPath( path ); + } // =====================================