diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index 8dd2a009..64e703c8 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -2761,10 +2761,7 @@ namespace Breeze bool Style::drawFrameTabBarBasePrimitive( const QStyleOption* option, QPainter* painter, const QWidget* ) const { - /* - tabbar frame - used either for 'separate' tabbar, or in 'document mode' - */ + // tabbar frame used either for 'separate' tabbar, or in 'document mode' // cast option and check const QStyleOptionTabBarBase* tabOption( qstyleoption_cast( option ) ); @@ -3333,48 +3330,45 @@ namespace Breeze const State& state( option->state ); const bool autoRaise( state & State_AutoRaise ); - // for toolbuttons, need to render the relevant part of the frame - if( (toolButtonOption->subControls & SC_ToolButtonMenu) && !autoRaise ) - { - - // store palette and rect - const QPalette& palette( option->palette ); - const QRect& rect( option->rect ); + // do nothing for autoraise buttons + if( autoRaise || !(toolButtonOption->subControls & SC_ToolButtonMenu) ) return true; - // store state - const bool enabled( state & State_Enabled ); - const bool hasFocus( enabled && ( state & State_HasFocus ) ); - const bool mouseOver( enabled && ( state & State_MouseOver ) ); - const bool sunken( enabled && ( state & State_Sunken ) ); + // store palette and rect + const QPalette& palette( option->palette ); + const QRect& rect( option->rect ); - // update animation state - // mouse over takes precedence over focus - _animations->widgetStateEngine().updateState( widget, AnimationHover, mouseOver ); - _animations->widgetStateEngine().updateState( widget, AnimationFocus, hasFocus && !mouseOver ); + // store state + const bool enabled( state & State_Enabled ); + const bool hasFocus( enabled && ( state & State_HasFocus ) ); + const bool mouseOver( enabled && ( state & State_MouseOver ) ); + const bool sunken( enabled && ( state & State_Sunken ) ); - const AnimationMode mode( _animations->widgetStateEngine().buttonAnimationMode( widget ) ); - const qreal opacity( _animations->widgetStateEngine().buttonOpacity( widget ) ); + // update animation state + // mouse over takes precedence over focus + _animations->widgetStateEngine().updateState( widget, AnimationHover, mouseOver ); + _animations->widgetStateEngine().updateState( widget, AnimationFocus, hasFocus && !mouseOver ); - // render as push button - const QColor shadow( _helper->shadowColor( palette ) ); - const QColor outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, opacity, mode ) ); - const QColor background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, opacity, mode ) ); + const AnimationMode mode( _animations->widgetStateEngine().buttonAnimationMode( widget ) ); + const qreal opacity( _animations->widgetStateEngine().buttonOpacity( widget ) ); - QRect frameRect( rect ); - painter->setClipRect( rect ); - frameRect.adjust( -Metrics::Frame_FrameRadius, 0, 0, 0 ); - frameRect = visualRect( option, frameRect ); + // render as push button + const QColor shadow( _helper->shadowColor( palette ) ); + const QColor outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, opacity, mode ) ); + const QColor background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, opacity, mode ) ); - // render - _helper->renderButtonFrame( painter, frameRect, background, outline, shadow, hasFocus, sunken ); + QRect frameRect( rect ); + painter->setClipRect( rect ); + frameRect.adjust( -Metrics::Frame_FrameRadius, 0, 0, 0 ); + frameRect = visualRect( option, frameRect ); - // also render separator - QRect separatorRect( rect.adjusted( 0, 2, -2, -2 ) ); - separatorRect.setWidth( 1 ); - separatorRect = visualRect( option, separatorRect ); - _helper->renderSeparator( painter, separatorRect, outline, true ); + // render + _helper->renderButtonFrame( painter, frameRect, background, outline, shadow, hasFocus, sunken ); - } + // also render separator + QRect separatorRect( rect.adjusted( 0, 2, -2, -2 ) ); + separatorRect.setWidth( 1 ); + separatorRect = visualRect( option, separatorRect ); + _helper->renderSeparator( painter, separatorRect, outline, true ); return true; @@ -5203,7 +5197,7 @@ namespace Breeze } // arrow - if( toolButtonOption->subControls & SC_ToolButtonMenu ) + if( hasPopupMenu ) { copy.rect = menuRect; diff --git a/kstyle/breezestyle.h b/kstyle/breezestyle.h index a83d40c5..5884bfca 100644 --- a/kstyle/breezestyle.h +++ b/kstyle/breezestyle.h @@ -275,26 +275,17 @@ namespace Breeze virtual bool drawProgressBarLabelControl( const QStyleOption*, QPainter*, const QWidget* ) const; virtual bool drawPushButtonLabelControl( const QStyleOption*, QPainter*, const QWidget* ) const; virtual bool drawCheckBoxLabelControl( const QStyleOption*, QPainter*, const QWidget* ) const; - - //* scrollbar virtual bool drawScrollBarSliderControl( const QStyleOption*, QPainter*, const QWidget* ) const; virtual bool drawScrollBarAddLineControl( const QStyleOption*, QPainter*, const QWidget* ) const; virtual bool drawScrollBarSubLineControl( const QStyleOption*, QPainter*, const QWidget* ) const; - virtual bool drawShapedFrameControl( const QStyleOption*, QPainter*, const QWidget* ) const; virtual bool drawRubberBandControl( const QStyleOption*, QPainter*, const QWidget* ) const; virtual bool drawHeaderSectionControl( const QStyleOption*, QPainter*, const QWidget* ) const; virtual bool drawHeaderEmptyAreaControl( const QStyleOption*, QPainter*, const QWidget* ) const; - - //* tabbar tabs. virtual bool drawTabBarTabLabelControl( const QStyleOption*, QPainter*, const QWidget* ) const; virtual bool drawTabBarTabShapeControl( const QStyleOption*, QPainter*, const QWidget* ) const; - - //* toolbox virtual bool drawToolBoxTabLabelControl( const QStyleOption*, QPainter*, const QWidget* ) const; virtual bool drawToolBoxTabShapeControl( const QStyleOption*, QPainter*, const QWidget* ) const; - - //* dock virtual bool drawDockWidgetTitleControl( const QStyleOption*, QPainter*, const QWidget* ) const; //*@}