diff --git a/kstyle/breezehelper.cpp b/kstyle/breezehelper.cpp index d3faa4fc..927dd317 100644 --- a/kstyle/breezehelper.cpp +++ b/kstyle/breezehelper.cpp @@ -847,7 +847,7 @@ namespace Breeze void Helper::renderCheckBoxBackground( QPainter* painter, const QRect& rect, const QPalette& palette, - CheckBoxState state, qreal animation ) const + CheckBoxState state, bool neutalHighlight, qreal animation ) const { // setup painter painter->setRenderHint( QPainter::Antialiasing, true ); @@ -857,12 +857,12 @@ namespace Breeze frameRect.adjust( 2, 2, -2, -2 ); frameRect = strokedRect(frameRect); - auto transparent = palette.highlight().color(); + auto transparent = neutalHighlight ? neutralText(palette) : palette.highlight().color(); transparent.setAlphaF(0.50); painter->setPen( transparentize( palette.text().color(), 0.5 ) ); if (state == CheckOn || state == CheckPartial) { - painter->setPen( palette.highlight().color() ); + painter->setPen( neutalHighlight ? neutralText(palette) : palette.highlight().color() ); } const auto radius = Metrics::CheckBox_Radius; @@ -895,6 +895,7 @@ namespace Breeze QPainter* painter, const QRect& rect, const QPalette& palette, bool mouseOver, CheckBoxState state, CheckBoxState target, + bool neutalHighlight, qreal animation, qreal hoverAnimation ) const { // setup painter @@ -911,7 +912,7 @@ namespace Breeze painter->setOpacity(hoverAnimation); } - painter->setPen( QPen( focusColor(palette), PenWidth::Frame ) ); + painter->setPen( QPen( neutalHighlight ? neutralText(palette) : focusColor(palette), PenWidth::Frame ) ); painter->setBrush( Qt::NoBrush ); painter->drawRoundedRect( frameRect.adjusted(0.5, 0.5, -0.5, -0.5), Metrics::CheckBox_Radius, Metrics::CheckBox_Radius ); @@ -984,7 +985,7 @@ namespace Breeze } //______________________________________________________________________________ - void Helper::renderRadioButtonBackground( QPainter* painter, const QRect& rect, const QPalette& palette, RadioButtonState state, qreal animation ) const + void Helper::renderRadioButtonBackground( QPainter* painter, const QRect& rect, const QPalette& palette, RadioButtonState state, bool neutalHighlight, qreal animation ) const { // setup painter @@ -995,12 +996,12 @@ namespace Breeze frameRect.adjust( 2, 2, -2, -2 ); frameRect.adjust( 0.5, 0.5, -0.5, -0.5 ); - auto transparent = palette.highlight().color(); + auto transparent = neutalHighlight ? neutralText(palette) : palette.highlight().color(); transparent.setAlphaF(0.50); painter->setPen( transparentize( palette.text().color(), 0.5 ) ); if (state == RadioOn) { - painter->setPen( palette.highlight().color() ); + painter->setPen( neutalHighlight ? neutralText(palette) : palette.highlight().color() ); } switch (state) { @@ -1026,7 +1027,7 @@ namespace Breeze void Helper::renderRadioButton( QPainter* painter, const QRect& rect, const QPalette& palette, bool mouseOver, - RadioButtonState state, qreal animation, qreal animationHover ) const + RadioButtonState state, bool neutralHighlight, qreal animation, qreal animationHover ) const { // setup painter painter->setRenderHint( QPainter::Antialiasing, true ); @@ -1042,7 +1043,7 @@ namespace Breeze painter->setOpacity(animationHover); } - painter->setPen( QPen( focusColor(palette), PenWidth::Frame ) ); + painter->setPen( QPen( neutralHighlight ? neutralText(palette) : focusColor(palette), PenWidth::Frame ) ); painter->setBrush( Qt::NoBrush ); const QRectF contentRect( frameRect.adjusted( 1, 1, -1, -1 ).adjusted( 0.5 , 0.5, -0.5, -0.5 ) ); diff --git a/kstyle/breezehelper.h b/kstyle/breezehelper.h index c0d0e0ef..641b59e4 100644 --- a/kstyle/breezehelper.h +++ b/kstyle/breezehelper.h @@ -192,16 +192,16 @@ namespace Breeze void renderSeparator( QPainter*, const QRect&, const QColor&, bool vertical = false ) const; //* checkbox - void renderCheckBoxBackground( QPainter*, const QRect&, const QPalette& palette, CheckBoxState state, qreal animation = AnimationData::OpacityInvalid ) const; + void renderCheckBoxBackground( QPainter*, const QRect&, const QPalette& palette, CheckBoxState state, bool neutalHighlight, qreal animation = AnimationData::OpacityInvalid ) const; //* checkbox - void renderCheckBox( QPainter*, const QRect&, const QPalette& palette, bool mouseOver, CheckBoxState state, CheckBoxState target, qreal animation = AnimationData::OpacityInvalid, qreal hoverAnimation = AnimationData::OpacityInvalid ) const; + void renderCheckBox( QPainter*, const QRect&, const QPalette& palette, bool mouseOver, CheckBoxState state, CheckBoxState target, bool neutalHighlight, qreal animation = AnimationData::OpacityInvalid, qreal hoverAnimation = AnimationData::OpacityInvalid ) const; //* radio button - void renderRadioButtonBackground( QPainter*, const QRect&, const QPalette& palette, RadioButtonState state, qreal animation = AnimationData::OpacityInvalid ) const; + void renderRadioButtonBackground( QPainter*, const QRect&, const QPalette& palette, RadioButtonState state, bool neutalHighlight, qreal animation = AnimationData::OpacityInvalid ) const; //* radio button - void renderRadioButton( QPainter*, const QRect&, const QPalette& palette, bool mouseOver, RadioButtonState state, qreal animation = AnimationData::OpacityInvalid, qreal hoverAnimation = AnimationData::OpacityInvalid ) const; + void renderRadioButton( QPainter*, const QRect&, const QPalette& palette, bool mouseOver, RadioButtonState state, bool neutalHighlight, qreal animation = AnimationData::OpacityInvalid, qreal hoverAnimation = AnimationData::OpacityInvalid ) const; //* slider groove void renderSliderGroove( QPainter*, const QRect&, const QColor& ) const; diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index a9e0debc..6db78632 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -3919,8 +3919,8 @@ namespace Breeze const qreal opacity( _animations->widgetStateEngine().opacity( widget, AnimationHover ) ); // render - _helper->renderCheckBoxBackground( painter, rect, palette, checkBoxState, animation ); - _helper->renderCheckBox( painter, rect, palette, mouseOver, checkBoxState, target, animation, opacity ); + _helper->renderCheckBoxBackground( painter, rect, palette, checkBoxState, hasHighlightNeutral( widget, option, mouseOver), animation ); + _helper->renderCheckBox( painter, rect, palette, mouseOver, checkBoxState, target, hasHighlightNeutral( widget, option, mouseOver), animation, opacity ); return true; } @@ -3951,8 +3951,8 @@ namespace Breeze const qreal opacity( _animations->widgetStateEngine().opacity( widget, AnimationHover ) ); // render - _helper->renderRadioButtonBackground( painter, rect, palette, radioButtonState, animation ); - _helper->renderRadioButton( painter, rect, palette, mouseOver, radioButtonState, animation, opacity ); + _helper->renderRadioButtonBackground( painter, rect, palette, radioButtonState, hasHighlightNeutral( widget, option, mouseOver), animation ); + _helper->renderRadioButton( painter, rect, palette, mouseOver, radioButtonState, hasHighlightNeutral( widget, option, mouseOver), animation, opacity ); return true; @@ -4862,16 +4862,16 @@ namespace Breeze const bool active( menuItemOption->checked ); const auto shadow( _helper->shadowColor( palette ) ); const auto color( _helper->checkBoxIndicatorColor( palette, false, enabled && active ) ); - _helper->renderCheckBoxBackground( painter, checkBoxRect, palette, state, AnimationData::OpacityInvalid ); - _helper->renderCheckBox( painter, checkBoxRect, palette, false, state, state ); + _helper->renderCheckBoxBackground( painter, checkBoxRect, palette, state, false, AnimationData::OpacityInvalid ); + _helper->renderCheckBox( painter, checkBoxRect, palette, false, state, state, false ); } else if( menuItemOption->checkType == QStyleOptionMenuItem::Exclusive ) { checkBoxRect = visualRect( option, checkBoxRect ); const bool active( menuItemOption->checked ); - _helper->renderRadioButtonBackground( painter, checkBoxRect, palette, active ? RadioOn : RadioOff, AnimationData::OpacityInvalid ); - _helper->renderRadioButton( painter, checkBoxRect, palette, false, active ? RadioOn:RadioOff ); + _helper->renderRadioButtonBackground( painter, checkBoxRect, palette, active ? RadioOn : RadioOff, false, AnimationData::OpacityInvalid ); + _helper->renderRadioButton( painter, checkBoxRect, palette, false, active ? RadioOn:RadioOff, false ); }