Changeset View
Changeset View
Standalone View
Standalone View
kstyle/breezestyle.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 5111 Lines • ▼ Show 20 Line(s) | 5099 | { | |||
---|---|---|---|---|---|
5112 | if( widget ) widgetMouseOver = _animations->scrollBarEngine().isHovered( widget, QStyle::SC_ScrollBarGroove ); | 5112 | if( widget ) widgetMouseOver = _animations->scrollBarEngine().isHovered( widget, QStyle::SC_ScrollBarGroove ); | ||
5113 | else if( option->styleObject ) widgetMouseOver = option->styleObject->property("hover").toBool(); | 5113 | else if( option->styleObject ) widgetMouseOver = option->styleObject->property("hover").toBool(); | ||
5114 | #else | 5114 | #else | ||
5115 | const bool widgetMouseOver( _animations->scrollBarEngine().isHovered( widget, QStyle::SC_ScrollBarGroove ) ); | 5115 | const bool widgetMouseOver( _animations->scrollBarEngine().isHovered( widget, QStyle::SC_ScrollBarGroove ) ); | ||
5116 | #endif | 5116 | #endif | ||
5117 | 5117 | | |||
5118 | qreal grooveAnimationOpacity( _animations->scrollBarEngine().opacity( widget, QStyle::SC_ScrollBarGroove ) ); | 5118 | qreal grooveAnimationOpacity( _animations->scrollBarEngine().opacity( widget, QStyle::SC_ScrollBarGroove ) ); | ||
5119 | if( grooveAnimationOpacity == AnimationData::OpacityInvalid ) grooveAnimationOpacity = (widgetMouseOver ? 1 : 0); | 5119 | if( grooveAnimationOpacity == AnimationData::OpacityInvalid ) grooveAnimationOpacity = (widgetMouseOver ? 1 : 0); | ||
5120 | const qreal handleSize = StyleConfigData::animationsEnabled() ? ((Metrics::ScrollBar_SliderWidth / 2.0) * (1 - grooveAnimationOpacity) + Metrics::ScrollBar_SliderWidth * grooveAnimationOpacity) : (int)Metrics::ScrollBar_SliderWidth; | | |||
5121 | 5120 | | |||
5122 | // define handle rect | 5121 | // define handle rect | ||
5123 | QRect handleRect; | 5122 | QRect handleRect; | ||
5124 | const State& state( option->state ); | 5123 | const State& state( option->state ); | ||
5125 | const bool horizontal( state & State_Horizontal ); | 5124 | const bool horizontal( state & State_Horizontal ); | ||
5126 | if( horizontal ) handleRect = centerRect( rect, rect.width(), handleSize ); | 5125 | if( horizontal ) handleRect = centerRect( rect, rect.width(), Metrics::ScrollBar_SliderWidth ); | ||
5127 | else handleRect = centerRect( rect, handleSize, rect.height() ); | 5126 | else handleRect = centerRect( rect, Metrics::ScrollBar_SliderWidth, rect.height() ); | ||
5128 | 5127 | | |||
5129 | const bool enabled( state & State_Enabled ); | 5128 | const bool enabled( state & State_Enabled ); | ||
5130 | const bool mouseOver( enabled && ( state & State_MouseOver ) ); | 5129 | const bool mouseOver( enabled && ( state & State_MouseOver ) ); | ||
5131 | 5130 | | |||
5132 | // check focus from relevant parent | 5131 | // check focus from relevant parent | ||
5133 | const QWidget* parent( scrollBarParent( widget ) ); | 5132 | const QWidget* parent( scrollBarParent( widget ) ); | ||
5134 | const bool hasFocus( enabled && ( (widget && widget->hasFocus()) || (parent && parent->hasFocus()) ) ); | 5133 | const bool hasFocus( enabled && ( (widget && widget->hasFocus()) || (parent && parent->hasFocus()) ) ); | ||
5135 | 5134 | | |||
▲ Show 20 Lines • Show All 1417 Lines • ▼ Show 20 Line(s) | 6551 | { | |||
6553 | //the animation for QStyle::SC_ScrollBarGroove is special: it will animate | 6552 | //the animation for QStyle::SC_ScrollBarGroove is special: it will animate | ||
6554 | //the opacity of everything else as well, included slider and arrows | 6553 | //the opacity of everything else as well, included slider and arrows | ||
6555 | qreal opacity( _animations->scrollBarEngine().opacity( widget, QStyle::SC_ScrollBarGroove ) ); | 6554 | qreal opacity( _animations->scrollBarEngine().opacity( widget, QStyle::SC_ScrollBarGroove ) ); | ||
6556 | const bool animated( StyleConfigData::animationsEnabled() && _animations->scrollBarEngine().isAnimated( widget, AnimationHover, QStyle::SC_ScrollBarGroove ) ); | 6555 | const bool animated( StyleConfigData::animationsEnabled() && _animations->scrollBarEngine().isAnimated( widget, AnimationHover, QStyle::SC_ScrollBarGroove ) ); | ||
6557 | const bool mouseOver( option->state & State_MouseOver ); | 6556 | const bool mouseOver( option->state & State_MouseOver ); | ||
6558 | 6557 | | |||
6559 | if( opacity == AnimationData::OpacityInvalid ) opacity = 1; | 6558 | if( opacity == AnimationData::OpacityInvalid ) opacity = 1; | ||
6560 | 6559 | | |||
6560 | QRect separatorRect; | ||||
6561 | if ( option->state & State_Horizontal ) { | ||||
6562 | separatorRect = QRect(0, 0, option->rect.width(), 1); | ||||
6563 | } else { | ||||
6564 | separatorRect = alignedRect(option->direction, | ||||
6565 | Qt::AlignLeft, | ||||
6566 | QSize(1, option->rect.height()), option->rect); | ||||
ndavis: Use PenWidth::Frame instead of hardcoding 1. | |||||
6567 | } | ||||
6568 | | ||||
6569 | _helper->renderScrollBarBorder( painter, separatorRect, _helper->alphaColor( option->palette.color( QPalette::WindowText ), 0.1 )); | ||||
Another thing: hpereiradacosta: Another thing:
Color role should be QPalette::Text rather than WindowText, since the vast… | |||||
6570 | | ||||
6561 | // render full groove directly, rather than using the addPage and subPage control element methods | 6571 | // render full groove directly, rather than using the addPage and subPage control element methods | ||
6562 | if( (!StyleConfigData::animationsEnabled() || mouseOver || animated) && option->subControls & SC_ScrollBarGroove ) | 6572 | if( (!StyleConfigData::animationsEnabled() || mouseOver || animated) && option->subControls & SC_ScrollBarGroove ) | ||
6563 | { | 6573 | { | ||
6564 | // retrieve groove rectangle | 6574 | // retrieve groove rectangle | ||
6565 | auto grooveRect( subControlRect( CC_ScrollBar, option, SC_ScrollBarGroove, widget ) ); | 6575 | auto grooveRect( subControlRect( CC_ScrollBar, option, SC_ScrollBarGroove, widget ) ); | ||
6566 | 6576 | | |||
6567 | const auto& palette( option->palette ); | 6577 | const auto& palette( option->palette ); | ||
6568 | const auto color( _helper->alphaColor( palette.color( QPalette::WindowText ), 0.3 * (animated ? opacity : 1) ) ); | 6578 | const auto color( _helper->alphaColor( palette.color( QPalette::WindowText ), 0.3 * (animated ? opacity : 1) ) ); | ||
▲ Show 20 Lines • Show All 679 Lines • Show Last 20 Lines |
Use PenWidth::Frame instead of hardcoding 1.