if( flags & ( State_Sunken|State_On ) )
{
- {
-
- // fill hole
- qreal opacity = 1.0;
- const qreal bias = 0.75;
- opacity = 1.0 - bias;
-
- if( opacity > 0 )
- {
- QColor color( helper().backgroundColor( helper().calcMidColor( palette.color( QPalette::Window ) ), widget, slitRect.center() ) );
- color = helper().alphaColor( color, opacity );
- painter->save();
- painter->setRenderHint( QPainter::Antialiasing );
- painter->setPen( Qt::NoPen );
- painter->setBrush( color );
- painter->drawRoundedRect( slitRect.adjusted( 1, 1, -1, -1 ), 3.5, 3.5 );
- painter->restore();
- }
-
- }
-
-
HoleOptions options( HoleContrast );
if( hasFocus && enabled ) options |= HoleFocus;
if( mouseOver && enabled ) options |= HoleHover;
if( hasFocus ) opts |= Focus;
if( mouseOver ) opts |= Hover;
- // adjust opacity and animation mode
- qreal opacity( -1 );
-
// paint frame
painter->save();
if( reverseLayout )
if( flags & ( State_On|State_Sunken ) ) opts |= Sunken;
painter->setClipRect( frameRect.adjusted( 0, 0, -8, 0 ), Qt::IntersectClip );
- renderButtonSlab( painter, frameRect, background, opts, opacity, TileSet::Bottom | TileSet::Top | TileSet::Left );
+ renderButtonSlab( painter, frameRect, background, opts, TileSet::Bottom | TileSet::Top | TileSet::Left );
} else {
if( flags & ( State_On|State_Sunken ) ) opts |= Sunken;
painter->setClipRect( frameRect.adjusted( 8, 0, 0, 0 ), Qt::IntersectClip );
- renderButtonSlab( painter, frameRect, background, opts, opacity, TileSet::Bottom | TileSet::Top | TileSet::Right );
+ renderButtonSlab( painter, frameRect, background, opts, TileSet::Bottom | TileSet::Top | TileSet::Right );
}
if( handleActive && mouseOver ) opts |= Hover;
const QColor color( helper().backgroundColor( palette.color( QPalette::Button ), widget, r.center() ) );
- const QColor glow( slabShadowColor( color, opts, -1 ) );
+ const QColor glow( slabShadowColor( color, opts ) );
const bool sunken( flags & (State_On|State_Sunken) );
painter->drawPixmap( r.topLeft(), helper().sliderSlab( color, glow, sunken, 0.0 ) );
}
//_________________________________________________________________________________
- void Style::renderDialSlab( QPainter *painter, const QRect& r, const QColor &color, const QStyleOption *option, StyleOptions opts, qreal opacity ) const
+ void Style::renderDialSlab( QPainter *painter, const QRect& r, const QColor &color, const QStyleOption *option, StyleOptions opts ) const
{
// cast option
const QRect rect( centerRect( r, dimension, dimension ) );
// calculate glow color
- const QColor glow( slabShadowColor( color, opts, opacity ) );
+ const QColor glow( slabShadowColor( color, opts ) );
// get main slab
QPixmap pix( helper().dialSlab( color, glow, 0.0, dimension ) );
}
//____________________________________________________________________________________
- void Style::renderButtonSlab( QPainter *painter, QRect r, const QColor &color, StyleOptions options, qreal opacity,
+ void Style::renderButtonSlab( QPainter *painter, QRect r, const QColor &color, StyleOptions options,
TileSet::Tiles tiles ) const
{
if( ( r.width() <= 0 ) || ( r.height() <= 0 ) ) return;
} else {
- QColor glow = slabShadowColor( color, options, opacity );
+ QColor glow = slabShadowColor( color, options );
tile = helper().slab( color, glow, 0.0 );
}
void Style::renderSlab(
QPainter *painter, QRect r,
const QColor &color,
- StyleOptions options, qreal opacity,
+ StyleOptions options,
TileSet::Tiles tiles ) const
{
} else {
- // calculate proper glow color based on current settings and opacity
- const QColor glow( slabShadowColor( color, options, opacity) );
+ // calculate proper glow color based on current settings
+ const QColor glow( slabShadowColor( color, options) );
if( color.isValid() || glow.isValid() ) tile = helper().slab( color, glow , 0.0 );
else return;
}
//__________________________________________________________________________
- void Style::renderMenuItemRect( const QStyleOption* opt, const QRect& r, const QColor& base, const QPalette& palette, QPainter* painter, qreal opacity ) const
+ void Style::renderMenuItemRect( const QStyleOption* opt, const QRect& r, const QColor& base, const QPalette& palette, QPainter* painter ) const
{
- if( opacity == 0 ) return;
-
// get relevant color
// TODO: this is inconsistent with MenuBar color.
// this should change to properly account for 'sunken' state
pp.setCompositionMode( QPainter::CompositionMode_DestinationIn );
pp.drawRect( maskr );
- if( opacity >= 0 && opacity < 1 )
- {
- pp.setCompositionMode( QPainter::CompositionMode_DestinationIn );
- pp.fillRect( pm.rect(), helper().alphaColor( Qt::black, opacity ) );
- }
-
pp.end();
painter->drawPixmap( handleRTL( opt, r ), pm );
- } else {
-
- if( opacity >= 0 && opacity < 1 )
- { color.setAlphaF( opacity ); }
-
- helper().holeFlat( color, 0.0 )->render( r.adjusted( 1,2,-2,-1 ), painter, TileSet::Full );
-
}
}
QPainter* painter, const QRect& rect,
const QPalette& palette,
StyleOptions options,
- CheckBoxState state,
- qreal opacity ) const
+ CheckBoxState state) const
{
const int s( CheckBox_Size );
const int y = r.y();
const QColor color( palette.color( QPalette::Button ) );
- const QColor glow( slabShadowColor( color, options, opacity ) );
+ const QColor glow( slabShadowColor( color, options ) );
painter->drawPixmap( x, y, helper().roundSlab( color, glow, 0.0 ) );
// draw the radio mark
//______________________________________________________________________________
void Style::renderScrollBarHandle(
QPainter* painter, const QRect& r, const QPalette& palette,
- const Qt::Orientation& orientation, const bool& hover, const qreal& opacity ) const
+ const Qt::Orientation& orientation, const bool& hover ) const
{
if( !r.isValid() ) return;
const QColor shadow( helper().alphaColor( helper().calcShadowColor( color ), 0.4 ) );
const QColor hovered( helper().viewHoverBrush().brush( QPalette::Active ).color() );
- if( opacity >= 0 ) glow = KColorUtils::mix( shadow, hovered, opacity );
- else if( hover ) glow = hovered;
+ if( hover ) glow = hovered;
else glow = shadow;
helper().scrollHandle( color, glow )->
}
//____________________________________________________________________________________
- QColor Style::slabShadowColor( QColor color, StyleOptions options, qreal opacity ) const
+ QColor Style::slabShadowColor( QColor color, StyleOptions options ) const
{
QColor glow;
- if( opacity < 0 )
- {
-
- if( options & Hover ) glow = helper().viewHoverBrush().brush( QPalette::Active ).color();
- else if( options & Focus ) glow = helper().viewFocusBrush().brush( QPalette::Active ).color();
- else if( ( options & SubtleShadow ) && color.isValid() ) glow = helper().alphaColor( helper().calcShadowColor( color ), 0.15 );
-
-
- }
+
+ if( options & Hover ) glow = helper().viewHoverBrush().brush( QPalette::Active ).color();
+ else if( options & Focus ) glow = helper().viewFocusBrush().brush( QPalette::Active ).color();
+ else if( ( options & SubtleShadow ) && color.isValid() ) glow = helper().alphaColor( helper().calcShadowColor( color ), 0.15 );
return glow;
}
//@{
//! qdial slab
- void renderDialSlab( QPainter* p, const QRect& r, const QColor& c, const QStyleOption* option, StyleOptions opts = 0 ) const
- { renderDialSlab( p, r, c, option, opts, -1 ); }
-
- //! qdial slab
- void renderDialSlab( QPainter*, const QRect&, const QColor&, const QStyleOption*, StyleOptions, qreal ) const;
+ void renderDialSlab( QPainter* p, const QRect& r, const QColor& c, const QStyleOption* option, StyleOptions opts = 0 ) const;
//! generic button slab
- void renderButtonSlab( QPainter* p, QRect r, const QColor& c, StyleOptions opts = 0, TileSet::Tiles tiles = TileSet::Ring) const
- { renderButtonSlab( p, r, c, opts, -1, tiles ); }
-
- //! generic button slab
- void renderButtonSlab( QPainter*, QRect, const QColor&, StyleOptions, qreal, TileSet::Tiles ) const;
+ void renderButtonSlab( QPainter* p, QRect r, const QColor& c, StyleOptions opts = 0, TileSet::Tiles tiles = TileSet::Ring) const;
//! generic slab
void renderSlab( QPainter* painter, const SlabRect& slab, const QColor& color, StyleOptions options = 0 ) const
{ renderSlab( painter, slab._r, color, options, slab._tiles ); }
//! generic slab
- void renderSlab( QPainter* painter, QRect rect, const QColor& color, StyleOptions options = 0, TileSet::Tiles tiles = TileSet::Ring) const
- { renderSlab( painter, rect, color, options, -1, tiles ); }
-
- //! generic slab
- void renderSlab( QPainter* painter, const SlabRect& slab, const QColor& color, StyleOptions options, qreal opacity ) const
- { renderSlab( painter, slab._r, color, options, opacity, slab._tiles ); }
-
- //! generic slab
- void renderSlab( QPainter*, QRect, const QColor&, StyleOptions, qreal, TileSet::Tiles ) const;
+ void renderSlab( QPainter* painter, QRect rect, const QColor& color, StyleOptions options = 0, TileSet::Tiles tiles = TileSet::Ring) const;
// render tab background
void renderTabBackground( QPainter*, const QRect&, const QPalette&, const QTabBar::Shape, const QWidget* ) const;
void renderHeaderBackground( const QRect&, const QPalette&, QPainter*, const QWidget*, bool horizontal, bool reverse ) const;
void renderHeaderLines( const QRect&, const QPalette&, QPainter*, TileSet::Tiles ) const;
- void renderMenuItemRect( const QStyleOption* opt, const QRect& rect, const QPalette& pal, QPainter* p, qreal opacity = -1 ) const
- { renderMenuItemRect( opt, rect, pal.color(QPalette::Window), p, opacity ); }
+ void renderMenuItemRect( const QStyleOption* opt, const QRect& rect, const QPalette& pal, QPainter* p ) const
+ { renderMenuItemRect( opt, rect, pal.color(QPalette::Window), p ); }
- void renderMenuItemRect( const QStyleOption*, const QRect&, const QColor&, const QPalette&, QPainter* p, qreal opacity = -1 ) const;
+ void renderMenuItemRect( const QStyleOption*, const QRect&, const QColor&, const QPalette&, QPainter* p ) const;
//! checkbox state (used for checkboxes _and_ radio buttons)
enum CheckBoxState
void renderCheckBox( QPainter*, const QRect&, const QPalette&, StyleOptions, CheckBoxState) const;
//! radio button
- void renderRadioButton( QPainter*, const QRect&, const QPalette&, StyleOptions, CheckBoxState, qreal opacity = -1 ) const;
+ void renderRadioButton( QPainter*, const QRect&, const QPalette&, StyleOptions, CheckBoxState ) const;
//! scrollbar hole
void renderScrollBarHole( QPainter*, const QRect&, const QColor&, const Qt::Orientation&, const TileSet::Tiles& = TileSet::Full ) const;
//! scrollbar handle (non animated)
void renderScrollBarHandle(
QPainter* painter, const QRect& r, const QPalette& palette,
- const Qt::Orientation& orientation, const bool& hover) const
- { renderScrollBarHandle( painter, r, palette, orientation, hover, -1 ); }
-
- //! scrollbar handle (animated)
- void renderScrollBarHandle( QPainter*, const QRect&, const QPalette&, const Qt::Orientation&, const bool&, const qreal& ) const;
+ const Qt::Orientation& orientation, const bool& hover) const;
//! scrollbar arrow
void renderScrollBarArrow( QPainter*, const QRect&, const QColor&, const QColor&, ArrowOrientation ) const;
//@}
//! slab glowing color
- QColor slabShadowColor( QColor, StyleOptions, qreal ) const;
+ QColor slabShadowColor( QColor, StyleOptions ) const;
//! returns point position for generic arrows
QPolygonF genericArrow( ArrowOrientation, ArrowSize = ArrowNormal ) const;