improved and simplified window decoration buttons.
parent
0393983755
commit
a05eecf4f0
|
@ -67,49 +67,20 @@ namespace Oxygen
|
||||||
p.setRenderHints(QPainter::Antialiasing);
|
p.setRenderHints(QPainter::Antialiasing);
|
||||||
p.setPen(Qt::NoPen);
|
p.setPen(Qt::NoPen);
|
||||||
p.setWindow( 0, 0, 18, 18 );
|
p.setWindow( 0, 0, 18, 18 );
|
||||||
p.translate( 0.5, (0.5-0.668) );
|
|
||||||
|
|
||||||
// button glow
|
// button glow
|
||||||
if( glow.isValid() )
|
if( glow.isValid() )
|
||||||
{
|
{
|
||||||
|
p.save();
|
||||||
{
|
p.translate( 0, -1.2 );
|
||||||
// outer shadow
|
drawShadow( p, glow, 18 );
|
||||||
QRadialGradient rg( 8.5, 8.5, 8.5 );
|
p.restore();
|
||||||
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// button slab
|
// button slab
|
||||||
if( color.isValid() )
|
if( color.isValid() )
|
||||||
{
|
{
|
||||||
|
p.translate( 0, (0.5-0.668) );
|
||||||
|
|
||||||
const QColor light( calcLightColor(color) );
|
const QColor light( calcLightColor(color) );
|
||||||
const QColor dark( calcDarkColor(color) );
|
const QColor dark( calcDarkColor(color) );
|
||||||
|
@ -126,7 +97,7 @@ namespace Oxygen
|
||||||
lg.setColorAt( 1, dark );
|
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.setBrush( lg );
|
||||||
p.drawEllipse( r );
|
p.drawEllipse( r );
|
||||||
}
|
}
|
||||||
|
@ -137,7 +108,7 @@ namespace Oxygen
|
||||||
QLinearGradient lg( 0, 1.665, 0, (2.0*12.33+1.665) );
|
QLinearGradient lg( 0, 1.665, 0, (2.0*12.33+1.665) );
|
||||||
lg.setColorAt( 0, light );
|
lg.setColorAt( 0, light );
|
||||||
lg.setColorAt( 1, dark );
|
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.setPen( QPen( lg, penWidth ) );
|
||||||
p.setBrush( Qt::NoBrush );
|
p.setBrush( Qt::NoBrush );
|
||||||
p.drawEllipse( r );
|
p.drawEllipse( r );
|
||||||
|
|
Loading…
Reference in New Issue