kstyle: Disable some button effects when not enabled

wilder-5.24
Noah Davis 5 years ago
parent c4f93a4be5
commit d6ca4f3f06
  1. 10
      kstyle/breezehelper.cpp

@ -579,7 +579,7 @@ namespace Breeze
// Colors // Colors
if (flat) { if (flat) {
if (down) { if (down && enabled) {
bgBrush = alphaColor(highlightColor, 0.333); bgBrush = alphaColor(highlightColor, 0.333);
} else if (checked) { } else if (checked) {
bgBrush = hasNeutralHighlight ? alphaColor(neutralText(palette), 0.333) bgBrush = hasNeutralHighlight ? alphaColor(neutralText(palette), 0.333)
@ -598,7 +598,7 @@ namespace Breeze
penBrush = hasNeutralHighlight ? neutralText(palette) : bgBrush; penBrush = hasNeutralHighlight ? neutralText(palette) : bgBrush;
} }
} else { } else {
if (down) { if (down && enabled) {
bgBrush = KColorUtils::mix(palette.button().color(), highlightColor, 0.333); bgBrush = KColorUtils::mix(palette.button().color(), highlightColor, 0.333);
} else if (checked) { } else if (checked) {
bgBrush = hasNeutralHighlight ? KColorUtils::mix(palette.button().color(), neutralText(palette), 0.333) bgBrush = hasNeutralHighlight ? KColorUtils::mix(palette.button().color(), neutralText(palette), 0.333)
@ -619,18 +619,18 @@ namespace Breeze
} }
} }
if (hovered || visualFocus || down) { if ((hovered || visualFocus || down) && enabled) {
penBrush = highlightColor; penBrush = highlightColor;
} }
// Animations // Animations
if (bgAnimation != AnimationData::OpacityInvalid) { if (bgAnimation != AnimationData::OpacityInvalid && enabled) {
QColor color1 = bgBrush.color(); QColor color1 = bgBrush.color();
QColor color2 = flat ? alphaColor(highlightColor, 0.333) QColor color2 = flat ? alphaColor(highlightColor, 0.333)
: KColorUtils::mix(palette.button().color(), highlightColor, 0.333); : KColorUtils::mix(palette.button().color(), highlightColor, 0.333);
bgBrush = KColorUtils::mix(color1, color2, bgAnimation); bgBrush = KColorUtils::mix(color1, color2, bgAnimation);
} }
if (penAnimation != AnimationData::OpacityInvalid) { if (penAnimation != AnimationData::OpacityInvalid && enabled) {
QColor color1 = penBrush.color(); QColor color1 = penBrush.color();
QColor color2 = highlightColor; QColor color2 = highlightColor;
penBrush = KColorUtils::mix(color1, color2, penAnimation); penBrush = KColorUtils::mix(color1, color2, penAnimation);

Loading…
Cancel
Save