From daa85d19b7a29ded673e02eff5768665e9d2e11b Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Tue, 19 Jun 2007 16:46:40 +0000 Subject: [PATCH] Improve rendering of color scheme items a little more. svn path=/trunk/KDE/kdebase/apps/konsole/; revision=677658 --- src/EditProfileDialog.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp index 9f10f7887..2b29956b4 100644 --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -938,7 +938,7 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte painter->setRenderHint( QPainter::Antialiasing ); // draw background - painter->setPen( QPen(Qt::NoPen) ); // QPen(scheme->foregroundColor() , 1) ); + painter->setPen( QPen(scheme->foregroundColor() , 1) ); // radial gradient for background // from a lightened version of the scheme's background color in the center to @@ -950,6 +950,11 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte backgroundGradient.setColorAt( 0 , color.lighter(105) ); backgroundGradient.setColorAt( 1 , color.darker(115) ); + const int backgroundRectXRoundness = 4; + const int backgroundRectYRoundness = 30; + + QPainterPath backgroundRectPath(backgroundRect.topLeft()); + backgroundRectPath.addRoundRect( backgroundRect , backgroundRectXRoundness , backgroundRectYRoundness ); if ( transparencyAvailable ) { @@ -958,15 +963,24 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte painter->setCompositionMode( QPainter::CompositionMode_Source ); painter->setBrush(backgroundGradient); - painter->drawRoundRect( backgroundRect , 4 , 30 ); + painter->drawPath(backgroundRectPath); painter->restore(); } else { painter->setBrush(backgroundGradient); - painter->drawRoundRect( backgroundRect , 4 , 30 ); + painter->drawPath(backgroundRectPath); } + // draw stripe at the side using scheme's foreground color + painter->setPen( QPen(Qt::NoPen) ); + QPainterPath path( option.rect.topLeft() ); + path.lineTo( option.rect.width() / 10.0 , option.rect.top() ); + path.lineTo( option.rect.bottomLeft() ); + path.lineTo( option.rect.topLeft() ); + painter->setBrush( scheme->foregroundColor() ); + painter->drawPath(path.intersected(backgroundRectPath)); + // draw highlight // with a linear gradient going from translucent white to transparent QLinearGradient gradient( option.rect.topLeft() , option.rect.bottomLeft() ); @@ -991,6 +1005,8 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte pen.setJoinStyle(Qt::MiterJoin); painter->setPen(pen); + + painter->drawRect( option.rect.adjusted(selectedBorderWidth/2, selectedBorderWidth/2, -selectedBorderWidth/2,