diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -5009,12 +5009,22 @@ const auto& rect( option->rect ); const auto& palette( option->palette ); + //try to understand if anywhere the widget is under mouse, not just the handle + bool widgetMouseOver( ( option->state & State_MouseOver ) ); + if( widget ) widgetMouseOver = widget->underMouse(); + // in case this QStyle is used by QQuickControls QStyle wrapper + else if( option->styleObject ) widgetMouseOver = option->styleObject->property("hover").toBool(); + + qreal grooveAnimationOpacity( _animations->scrollBarEngine().opacity( widget, QStyle::SC_ScrollBarGroove ) ); + if( grooveAnimationOpacity == AnimationData::OpacityInvalid ) grooveAnimationOpacity = (widgetMouseOver ? 1 : 0); + const qreal handleSize = StyleConfigData::animationsEnabled() ? ((Metrics::ScrollBar_SliderWidth / 2.0) * (1 - grooveAnimationOpacity) + Metrics::ScrollBar_SliderWidth * grooveAnimationOpacity) : Metrics::ScrollBar_SliderWidth; + // define handle rect QRect handleRect; const State& state( option->state ); const bool horizontal( state & State_Horizontal ); - if( horizontal ) handleRect = centerRect( rect, rect.width(), Metrics::ScrollBar_SliderWidth ); - else handleRect = centerRect( rect, Metrics::ScrollBar_SliderWidth, rect.height() ); + if( horizontal ) handleRect = centerRect( rect, rect.width(), handleSize ); + else handleRect = centerRect( rect, handleSize, rect.height() ); const bool enabled( state & State_Enabled ); const bool mouseOver( enabled && ( state & State_MouseOver ) ); @@ -5030,8 +5040,11 @@ _animations->scrollBarEngine().updateState( widget, AnimationHover, mouseOver && handleActive ); const auto mode( _animations->scrollBarEngine().animationMode( widget, SC_ScrollBarSlider ) ); - const qreal opacity( _animations->scrollBarEngine().opacity( widget, SC_ScrollBarSlider ) ); - const auto color = _helper->scrollBarHandleColor( palette, mouseOver, hasFocus, opacity, mode ); + qreal opacity( _animations->scrollBarEngine().opacity( widget, SC_ScrollBarSlider ) ); + auto color = _helper->scrollBarHandleColor( palette, mouseOver, hasFocus, opacity, mode ); + if (StyleConfigData::animationsEnabled()) { + color.setAlphaF(color.alphaF() * (0.7 + grooveAnimationOpacity)); + } _helper->renderScrollBarHandle( painter, handleRect, color ); return true;