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 2720 Lines • ▼ Show 20 Line(s) | 2717 | { | |||
---|---|---|---|---|---|
2721 | if( !toolButtonOption ) return contentsSize; | 2721 | if( !toolButtonOption ) return contentsSize; | ||
2722 | 2722 | | |||
2723 | // copy size | 2723 | // copy size | ||
2724 | QSize size = contentsSize; | 2724 | QSize size = contentsSize; | ||
2725 | 2725 | | |||
2726 | // get relevant state flags | 2726 | // get relevant state flags | ||
2727 | const State& state( option->state ); | 2727 | const State& state( option->state ); | ||
2728 | const bool autoRaise( state & State_AutoRaise ); | 2728 | const bool autoRaise( state & State_AutoRaise ); | ||
2729 | const bool hasPopupMenu( toolButtonOption->features & QStyleOptionToolButton::MenuButtonPopup ); | | |||
2730 | const bool hasInlineIndicator( | | |||
2731 | toolButtonOption->features&QStyleOptionToolButton::HasMenu | | |||
2732 | && toolButtonOption->features&QStyleOptionToolButton::PopupDelay | | |||
2733 | && !hasPopupMenu ); | | |||
2734 | 2729 | | |||
2735 | const int marginWidth( autoRaise ? Metrics::ToolButton_MarginWidth : Metrics::Button_MarginWidth + Metrics::Frame_FrameWidth ); | 2730 | const int marginWidth( autoRaise ? Metrics::ToolButton_MarginWidth : Metrics::Button_MarginWidth + Metrics::Frame_FrameWidth ); | ||
2736 | 2731 | | |||
2737 | if( hasInlineIndicator ) size.rwidth() += Metrics::ToolButton_InlineIndicatorWidth; | | |||
2738 | size = expandSize( size, marginWidth ); | 2732 | size = expandSize( size, marginWidth ); | ||
2739 | 2733 | | |||
2740 | return size; | 2734 | return size; | ||
2741 | 2735 | | |||
2742 | } | 2736 | } | ||
2743 | 2737 | | |||
2744 | //______________________________________________________________ | 2738 | //______________________________________________________________ | ||
2745 | QSize Style::menuBarItemSizeFromContents( const QStyleOption*, const QSize& contentsSize, const QWidget* ) const | 2739 | QSize Style::menuBarItemSizeFromContents( const QStyleOption*, const QSize& contentsSize, const QWidget* ) const | ||
▲ Show 20 Lines • Show All 3348 Lines • ▼ Show 20 Line(s) | 6083 | { | |||
6094 | if( sunken && !flat ) copy.rect.translate( 1, 1 ); | 6088 | if( sunken && !flat ) copy.rect.translate( 1, 1 ); | ||
6095 | drawPrimitive( PE_IndicatorArrowDown, ©, painter, widget ); | 6089 | drawPrimitive( PE_IndicatorArrowDown, ©, painter, widget ); | ||
6096 | 6090 | | |||
6097 | } else if( hasInlineIndicator ) { | 6091 | } else if( hasInlineIndicator ) { | ||
6098 | 6092 | | |||
6099 | copy.rect = menuRect; | 6093 | copy.rect = menuRect; | ||
6100 | 6094 | | |||
6101 | if( sunken && !flat ) copy.rect.translate( 1, 1 ); | 6095 | if( sunken && !flat ) copy.rect.translate( 1, 1 ); | ||
6102 | drawPrimitive( PE_IndicatorArrowDown, ©, painter, widget ); | 6096 | drawIndicatorArrowPrimitive( ArrowDown_Small, ©, painter, widget ); | ||
6103 | 6097 | | |||
6104 | } | 6098 | } | ||
6105 | 6099 | | |||
6106 | // contents | 6100 | // contents | ||
6107 | { | 6101 | { | ||
6108 | 6102 | | |||
6109 | // restore state | 6103 | // restore state | ||
6110 | copy.state = state; | 6104 | copy.state = state; | ||
Show All 11 Lines | 6113 | { | |||
6122 | // adjust state to have correct icon rendered | 6116 | // adjust state to have correct icon rendered | ||
6123 | const auto button( qobject_cast<const QAbstractButton*>( widget ) ); | 6117 | const auto button( qobject_cast<const QAbstractButton*>( widget ) ); | ||
6124 | if( button->isChecked() || button->isDown() ) copy.state |= State_On; | 6118 | if( button->isChecked() || button->isDown() ) copy.state |= State_On; | ||
6125 | 6119 | | |||
6126 | } else if( !inTabBar && hasInlineIndicator ) { | 6120 | } else if( !inTabBar && hasInlineIndicator ) { | ||
6127 | 6121 | | |||
6128 | const int marginWidth( flat ? Metrics::ToolButton_MarginWidth : Metrics::Button_MarginWidth + Metrics::Frame_FrameWidth ); | 6122 | const int marginWidth( flat ? Metrics::ToolButton_MarginWidth : Metrics::Button_MarginWidth + Metrics::Frame_FrameWidth ); | ||
6129 | contentsRect = insideMargin( contentsRect, marginWidth, 0 ); | 6123 | contentsRect = insideMargin( contentsRect, marginWidth, 0 ); | ||
6130 | contentsRect.setRight( contentsRect.right() - Metrics::ToolButton_InlineIndicatorWidth ); | | |||
6131 | contentsRect = visualRect( option, contentsRect ); | 6124 | contentsRect = visualRect( option, contentsRect ); | ||
6132 | 6125 | | |||
6133 | } | 6126 | } | ||
6134 | 6127 | | |||
6135 | copy.rect = contentsRect; | 6128 | copy.rect = contentsRect; | ||
6136 | 6129 | | |||
6137 | // render | 6130 | // render | ||
6138 | drawControl( CE_ToolButtonLabel, ©, painter, widget); | 6131 | drawControl( CE_ToolButtonLabel, ©, painter, widget); | ||
▲ Show 20 Lines • Show All 1118 Lines • Show Last 20 Lines |