-rw-r--r-- | core/applets/volumeapplet/oledbox.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/core/applets/volumeapplet/oledbox.cpp b/core/applets/volumeapplet/oledbox.cpp index 3036929..7547287 100644 --- a/core/applets/volumeapplet/oledbox.cpp +++ b/core/applets/volumeapplet/oledbox.cpp @@ -144,16 +144,18 @@ void OLedBox::paintEvent ( QPaintEvent *e ) void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNKEN led lamp { QPainter paint; QColor color; QBrush brush; QPen pen; + pix-> fill ( black ); + // First of all we want to know what area should be updated // Initialize coordinates, width, and height of the LED int width = pix-> width ( ); // Make sure the LED is round! if ( width > pix-> height ( )) width = pix-> height ( ); width -= 2; // leave one pixel border @@ -214,17 +216,20 @@ void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNK } // Drawing of bright spot finished, now draw a thin border // around the LED which resembles a shadow with light coming // from the upper left. #ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC paint. drawPixmap ( 0, 0, *s_border_pix ); - + paint. end ( ); + + pix-> setMask ( pix-> createHeuristicMask ( )); + #else pen.setWidth( 3 ); brush.setStyle( QBrush::NoBrush ); // Switch off the brush paint.setBrush( brush ); // This avoids filling of the ellipse // Set the initial color value to 200 (bright) and start // drawing the shadow border at 45 (45*16 = 720). int shadow_color = 200, angle; @@ -248,23 +253,23 @@ void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNK shadow_color = 255; } else { shadow_color -= 25; // set color to a darker value again if ( shadow_color < 100 ) shadow_color = 100; } // end if ( angle < 2320 ) } // end for ( angle = 720; angle < 6480; angle += 160 ) -#endif paint.end(); // // painting done QBitmap mask ( pix-> width ( ), pix-> height ( ), true ); QPainter mp ( &mask ); mp. setPen ( Qt::NoPen ); mp. setBrush ( Qt::color1 ); mp. drawEllipse ( 0, 0, width + 2, width + 2 ); mp. end ( ); - + pix-> setMask ( mask ); +#endif } |