improved and simplified window decoration buttons.

icc-effect-5.14.5
Hugo Pereira Da Costa 2011-09-16 17:49:45 +02:00
parent 0393983755
commit a05eecf4f0
1 changed files with 7 additions and 36 deletions

View File

@ -67,49 +67,20 @@ namespace Oxygen
p.setRenderHints(QPainter::Antialiasing);
p.setPen(Qt::NoPen);
p.setWindow( 0, 0, 18, 18 );
p.translate( 0.5, (0.5-0.668) );
// button glow
if( glow.isValid() )
{
{
// outer shadow
QRadialGradient rg( 8.5, 8.5, 8.5 );
static const int nPoints(5);
const qreal x[5] = { 0.61, 0.72, 0.81, 0.9, 1};
const qreal values[5] = { 255-172, 255-178, 255-210, 255-250, 0 };
QColor c = glow;
for( int i = 0; i<nPoints; i++ )
{ c.setAlpha( values[i] ); rg.setColorAt( x[i], c ); }
QRectF r( pixmap->rect() );
p.setBrush( rg );
p.drawRect( r );
}
{
// inner shadow
QRadialGradient rg( 8.5, 8.5, 8.5 );
static const int nPoints(6);
const qreal x[6] = { 0.61, 0.67, 0.7, 0.74, 0.78, 1 };
const qreal values[6] = { 255-92, 255-100, 255-135, 255-205, 255-250, 0 };
QColor c = glow;
for( int i = 0; i<nPoints; i++ )
{ c.setAlpha( values[i] ); rg.setColorAt( x[i], c ); }
QRectF r( pixmap->rect() );
p.setBrush( rg );
p.drawRect( r );
}
p.save();
p.translate( 0, -1.2 );
drawShadow( p, glow, 18 );
p.restore();
}
// button slab
if( color.isValid() )
{
p.translate( 0, (0.5-0.668) );
const QColor light( calcLightColor(color) );
const QColor dark( calcDarkColor(color) );
@ -126,7 +97,7 @@ namespace Oxygen
lg.setColorAt( 1, dark );
}
const QRectF r( 0.5*(17-12.33), 1.665, 12.33, 12.33 );
const QRectF r( 0.5*(18-12.33), 1.665, 12.33, 12.33 );
p.setBrush( lg );
p.drawEllipse( r );
}
@ -137,7 +108,7 @@ namespace Oxygen
QLinearGradient lg( 0, 1.665, 0, (2.0*12.33+1.665) );
lg.setColorAt( 0, light );
lg.setColorAt( 1, dark );
const QRectF r( 0.5*(17-12.33+penWidth), (1.665+penWidth), (12.33-penWidth), (12.33-penWidth) );
const QRectF r( 0.5*(18-12.33+penWidth), (1.665+penWidth), (12.33-penWidth), (12.33-penWidth) );
p.setPen( QPen( lg, penWidth ) );
p.setBrush( Qt::NoBrush );
p.drawEllipse( r );