From 22dfa799d44a237b9e07847072a4f091edf19cc9 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Mon, 24 Aug 2009 15:04:42 +0000 Subject: [PATCH] fixed button color svn path=/trunk/KDE/kdebase/workspace/; revision=1015114 --- clients/nitrogen/nitrogenbutton.cpp | 48 ++++++++++++++++++----------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/clients/nitrogen/nitrogenbutton.cpp b/clients/nitrogen/nitrogenbutton.cpp index d8ec2ca786..b699b86169 100644 --- a/clients/nitrogen/nitrogenbutton.cpp +++ b/clients/nitrogen/nitrogenbutton.cpp @@ -1,11 +1,8 @@ ////////////////////////////////////////////////////////////////////////////// -// Nitrogenbutton.cpp +// nitrogenbutton.cpp // ------------------- -// Nitrogen window decoration for KDE. Buttons. -// ------------------- -// Copyright (c) 2006, 2007 Riccardo Iaconelli -// Copyright (c) 2006, 2007 Casper Boemann -// Copyright (c) 2009, 2010 Hugo Pereira +// +// Copyright (c) 2009 Hugo Pereira Da Costa // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to @@ -23,10 +20,9 @@ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. +// IN THE SOFTWARE. ////////////////////////////////////////////////////////////////////////////// - #include #include @@ -208,22 +204,38 @@ namespace Nitrogen QLinearGradient lg = helper_.decoGradient( QRect( 4, 4, 13, 13 ), color); painter.setRenderHints(QPainter::Antialiasing); - painter.setBrush(Qt::NoBrush); qreal width( client_.configuration().buttonType() == NitrogenConfiguration::ButtonKde43 ? 1.4:2.2 ); - painter.setPen(QPen(lg, width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + + painter.setBrush(Qt::NoBrush); + if( client_.configuration().buttonType() == NitrogenConfiguration::ButtonKde42 ) + { + + painter.setPen(QPen(lg, width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + + } else { + + painter.setPen(QPen(color, width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + + } drawIcon(&painter, palette, type_); } else { - QLinearGradient lg = helper_.decoGradient( QRect( 0, 0, 13, 13 ), color); - painter.setRenderHints(QPainter::Antialiasing); - painter.setBrush(Qt::NoBrush); - painter.setPen(QPen(lg, 3.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); - drawIcon(&painter, palette, type_); - - painter.setPen(QPen( palette.color( backgroundRole() ), 1.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); - drawIcon(&painter, palette, type_); + // outlined mode + QPixmap pixmap(size()); + pixmap.fill(Qt::transparent); + QPainter pp(&pixmap); + pp.setRenderHints(QPainter::Antialiasing); + pp.setBrush(Qt::NoBrush); + pp.setPen(QPen(color, 3.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + drawIcon(&pp, palette, type_); + pp.setCompositionMode(QPainter::CompositionMode_DestinationOut); + pp.setPen(QPen(color, 1.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + drawIcon(&pp, palette, type_); + + painter.drawPixmap(QPoint(0,0), pixmap); + } }