Fix _kde_highlight_neutral

This fixes the application of _kde_highlight_neutral to radiobuttons
and checkbuttons.
wilder-5.24
Jan Blackquill 5 years ago committed by Nate Graham
parent 96e183e4d4
commit b7140f74e7
  1. 19
      kstyle/breezehelper.cpp
  2. 8
      kstyle/breezehelper.h
  3. 16
      kstyle/breezestyle.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 ) );

@ -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;

@ -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 );
}

Loading…
Cancel
Save