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 2318 Lines • ▼ Show 20 Line(s) | 2261 | { | |||
|---|---|---|---|---|---|
| 2319 | 2319 | | |||
| 2320 | return ParentStyleClass::subControlRect( CC_SpinBox, option, subControl, widget ); | 2320 | return ParentStyleClass::subControlRect( CC_SpinBox, option, subControl, widget ); | ||
| 2321 | 2321 | | |||
| 2322 | } | 2322 | } | ||
| 2323 | 2323 | | |||
| 2324 | //___________________________________________________________________________________________________________________ | 2324 | //___________________________________________________________________________________________________________________ | ||
| 2325 | QRect Style::scrollBarInternalSubControlRect( const QStyleOptionComplex* option, SubControl subControl ) const | 2325 | QRect Style::scrollBarInternalSubControlRect( const QStyleOptionComplex* option, SubControl subControl ) const | ||
| 2326 | { | 2326 | { | ||
| 2327 | | ||||
| 2328 | const auto& rect = option->rect; | | |||
| 2329 | const State& state( option->state ); | 2327 | const State& state( option->state ); | ||
| 2330 | const bool horizontal( state & State_Horizontal ); | 2328 | const bool horizontal( state & State_Horizontal ); | ||
| 2331 | 2329 | | |||
| 2330 | QRect rect = option->rect; | ||||
| 2331 | if (horizontal) { | ||||
| 2332 | rect.setTop(PenWidth::Frame); | ||||
| 2333 | } else { | ||||
| 2334 | rect.setLeft(PenWidth::Frame); | ||||
| 2335 | } | ||||
| 2336 | | ||||
| 2332 | switch( subControl ) | 2337 | switch( subControl ) | ||
| 2333 | { | 2338 | { | ||
| 2334 | 2339 | | |||
| 2335 | case SC_ScrollBarSubLine: | 2340 | case SC_ScrollBarSubLine: | ||
| 2336 | { | 2341 | { | ||
| 2337 | int majorSize( scrollBarButtonHeight( _subLineButtons ) ); | 2342 | int majorSize( scrollBarButtonHeight( _subLineButtons ) ); | ||
| 2338 | if( horizontal ) return visualRect( option, QRect( rect.left(), rect.top(), majorSize, rect.height() ) ); | 2343 | if( horizontal ) return visualRect( option, QRect( rect.left(), rect.top(), majorSize, rect.height() ) ); | ||
| 2339 | else return visualRect( option, QRect( rect.left(), rect.top(), rect.width(), majorSize ) ); | 2344 | else return visualRect( option, QRect( rect.left(), rect.top(), rect.width(), majorSize ) ); | ||
| ▲ Show 20 Lines • Show All 4212 Lines • ▼ Show 20 Line(s) | 6556 | { | |||
| 6552 | //the animation for QStyle::SC_ScrollBarGroove is special: it will animate | 6557 | //the animation for QStyle::SC_ScrollBarGroove is special: it will animate | ||
| 6553 | //the opacity of everything else as well, included slider and arrows | 6558 | //the opacity of everything else as well, included slider and arrows | ||
| 6554 | qreal opacity( _animations->scrollBarEngine().opacity( widget, QStyle::SC_ScrollBarGroove ) ); | 6559 | qreal opacity( _animations->scrollBarEngine().opacity( widget, QStyle::SC_ScrollBarGroove ) ); | ||
| 6555 | const bool animated( StyleConfigData::animationsEnabled() && _animations->scrollBarEngine().isAnimated( widget, AnimationHover, QStyle::SC_ScrollBarGroove ) ); | 6560 | const bool animated( StyleConfigData::animationsEnabled() && _animations->scrollBarEngine().isAnimated( widget, AnimationHover, QStyle::SC_ScrollBarGroove ) ); | ||
| 6556 | const bool mouseOver( option->state & State_MouseOver ); | 6561 | const bool mouseOver( option->state & State_MouseOver ); | ||
| 6557 | 6562 | | |||
| 6558 | if( opacity == AnimationData::OpacityInvalid ) opacity = 1; | 6563 | if( opacity == AnimationData::OpacityInvalid ) opacity = 1; | ||
| 6559 | 6564 | | |||
| 6565 | QRect separatorRect; | ||||
| 6566 | if ( option->state & State_Horizontal ) { | ||||
| 6567 | separatorRect = QRect(0, 0, option->rect.width(), 1); | ||||
| 6568 | } else { | ||||
| 6569 | separatorRect = alignedRect(option->direction, | ||||
| 6570 | Qt::AlignLeft, | ||||
| 6571 | QSize(1, option->rect.height()), option->rect); | ||||
ndavis: Use PenWidth::Frame instead of hardcoding 1. | |||||
| 6572 | } | ||||
| 6573 | | ||||
| 6574 | _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… | |||||
| 6575 | | ||||
| 6560 | // render full groove directly, rather than using the addPage and subPage control element methods | 6576 | // render full groove directly, rather than using the addPage and subPage control element methods | ||
| 6561 | if( (!StyleConfigData::animationsEnabled() || mouseOver || animated) && option->subControls & SC_ScrollBarGroove ) | 6577 | if( (!StyleConfigData::animationsEnabled() || mouseOver || animated) && option->subControls & SC_ScrollBarGroove ) | ||
| 6562 | { | 6578 | { | ||
| 6563 | // retrieve groove rectangle | 6579 | // retrieve groove rectangle | ||
| 6564 | auto grooveRect( subControlRect( CC_ScrollBar, option, SC_ScrollBarGroove, widget ) ); | 6580 | auto grooveRect( subControlRect( CC_ScrollBar, option, SC_ScrollBarGroove, widget ) ); | ||
| 6565 | 6581 | | |||
| 6566 | const auto& palette( option->palette ); | 6582 | const auto& palette( option->palette ); | ||
| 6567 | const auto color( _helper->alphaColor( palette.color( QPalette::WindowText ), 0.3 * (animated ? opacity : 1) ) ); | 6583 | 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.