fixed button color

svn path=/trunk/KDE/kdebase/workspace/; revision=1015114
This commit is contained in:
Hugo Pereira Da Costa 2009-08-24 15:04:42 +00:00
parent 828889ed03
commit 22dfa799d4

View file

@ -1,11 +1,8 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Nitrogenbutton.cpp // nitrogenbutton.cpp
// ------------------- // -------------------
// Nitrogen window decoration for KDE. Buttons. //
// ------------------- // Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
// Copyright (c) 2006, 2007 Riccardo Iaconelli <riccardo@kde.org>
// Copyright (c) 2006, 2007 Casper Boemann <cbr@boemann.dk>
// Copyright (c) 2009, 2010 Hugo Pereira <hugo.pereira@free.fr>
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to // 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 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 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 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE. // IN THE SOFTWARE.
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#include <cmath> #include <cmath>
#include <QPainterPath> #include <QPainterPath>
@ -208,22 +204,38 @@ namespace Nitrogen
QLinearGradient lg = helper_.decoGradient( QRect( 4, 4, 13, 13 ), color); QLinearGradient lg = helper_.decoGradient( QRect( 4, 4, 13, 13 ), color);
painter.setRenderHints(QPainter::Antialiasing); painter.setRenderHints(QPainter::Antialiasing);
painter.setBrush(Qt::NoBrush);
qreal width( client_.configuration().buttonType() == NitrogenConfiguration::ButtonKde43 ? 1.4:2.2 ); 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_); drawIcon(&painter, palette, type_);
} else { } else {
QLinearGradient lg = helper_.decoGradient( QRect( 0, 0, 13, 13 ), color); // outlined mode
painter.setRenderHints(QPainter::Antialiasing); QPixmap pixmap(size());
painter.setBrush(Qt::NoBrush); pixmap.fill(Qt::transparent);
painter.setPen(QPen(lg, 3.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QPainter pp(&pixmap);
drawIcon(&painter, palette, type_); pp.setRenderHints(QPainter::Antialiasing);
pp.setBrush(Qt::NoBrush);
painter.setPen(QPen( palette.color( backgroundRole() ), 1.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); pp.setPen(QPen(color, 3.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
drawIcon(&painter, palette, type_); 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);
} }
} }