Fixed flat+sunken toolbuttons rendering when focusing in/out

wilder-pre-rebase
Hugo Pereira Da Costa 12 years ago
parent b9e1b4a325
commit 9aed8af8bf
  1. 10
      kstyle/breezehelper.cpp
  2. 2
      kstyle/breezehelper.h
  3. 6
      kstyle/breezestyle.cpp

@ -226,7 +226,8 @@ namespace Breeze
}
//____________________________________________________________________
QColor Helper::toolButtonColor( const QPalette& palette, bool mouseOver, bool hasFocus, qreal opacity, AnimationMode mode ) const
// QColor Helper::toolButtonColor( const QPalette& palette, bool mouseOver, bool hasFocus, qreal opacity, AnimationMode mode ) const
QColor Helper::toolButtonColor( const QPalette& palette, bool mouseOver, bool hasFocus, bool sunken, qreal opacity, AnimationMode mode ) const
{
QColor outline;
@ -237,7 +238,7 @@ namespace Breeze
const QColor hover( hoverColor( palette ) );
const QColor focus( focusColor( palette ) );
if( hasFocus ) outline = KColorUtils::mix( focus, hover, opacity );
if( hasFocus || sunken ) outline = KColorUtils::mix( focus, hover, opacity );
else outline = alphaColor( hover, opacity );
} else if( mouseOver ) {
@ -247,9 +248,10 @@ namespace Breeze
} else if( mode == AnimationFocus ) {
const QColor focus( focusColor( palette ) );
outline = alphaColor( focus, opacity );
if( sunken ) outline = focus;
else outline = alphaColor( focus, opacity );
} else if( hasFocus ) {
} else if( hasFocus || sunken ) {
outline = focusColor( palette );

@ -123,7 +123,7 @@ namespace Breeze
QColor buttonBackgroundColor( const QPalette&, bool mouseOver, bool hasFocus, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
//* tool button color
QColor toolButtonColor( const QPalette&, bool mouseOver, bool hasFocus, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
QColor toolButtonColor( const QPalette&, bool mouseOver, bool hasFocus, bool sunken, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
//* slider outline color, using animations
QColor sliderOutlineColor( const QPalette&, bool mouseOver, bool hasFocus, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;

@ -2954,7 +2954,7 @@ namespace Breeze
// define colors and render
const QPalette& palette( option->palette );
const QColor color( _helper->toolButtonColor( palette, mouseOver, hasFocus || sunken, opacity, mode ) );
const QColor color( _helper->toolButtonColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) );
_helper->renderToolButtonFrame( painter, rect, color, sunken );
} else {
@ -3027,7 +3027,7 @@ namespace Breeze
} else {
const QColor color( _helper->toolButtonColor( palette, mouseOver, hasFocus || sunken, opacity, mode ) );
const QColor color( _helper->toolButtonColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) );
_helper->renderToolButtonFrame( painter, rect, color, sunken );
}
@ -5320,7 +5320,7 @@ namespace Breeze
if( flat ) {
// define colors and render
const QColor color( _helper->toolButtonColor( palette, mouseOver, hasFocus || sunken, opacity, mode ) );
const QColor color( _helper->toolButtonColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) );
_helper->renderToolButtonFrame( painter, rect, color, sunken );
} else {

Loading…
Cancel
Save