[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [breeze] kstyle: Draw mouse-over rect over the full toolbutton even if it has a menu
From:       Hugo Pereira Da Costa <null () kde ! org>
Date:       2018-05-18 7:45:29
Message-ID: E1fJa4v-0002Gk-OW () code ! kde ! org
[Download RAW message or body]

Git commit 32d8b02880a237e6de415861500a018a5cd09781 by Hugo Pereira Da Costa.
Committed on 18/05/2018 at 07:45.
Pushed by hpereiradacosta into branch 'master'.

Draw mouse-over rect over the full toolbutton even if it has a menu

M  +19   -20   kstyle/breezestyle.cpp

https://commits.kde.org/breeze/32d8b02880a237e6de415861500a018a5cd09781

diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp
index ef35107f..28746216 100644
--- a/kstyle/breezestyle.cpp
+++ b/kstyle/breezestyle.cpp
@@ -3359,37 +3359,38 @@ namespace Breeze
             // cast option
             const QStyleOptionToolButton* toolButtonOption( static_cast<const \
                QStyleOptionToolButton*>( option ) );
             const bool hasPopupMenu( toolButtonOption->subControls & \
SC_ToolButtonMenu ); +            const bool sunken( state & (State_On | \
State_Sunken) );  if( flat && hasPopupMenu )
             {
 
-                // for menu arrows in flat toolbutton one uses animations to get the \
                arrow color
-                // handle arrow over animation
-                const bool arrowHover( mouseOver && ( \
                toolButtonOption->activeSubControls & SC_ToolButtonMenu ) );
-                _animations->toolButtonEngine().updateState( widget, AnimationHover, \
arrowHover ); +                if( sunken && !mouseOver ) color = palette.color( \
QPalette::HighlightedText ); +                else {
 
-                const bool animated( _animations->toolButtonEngine().isAnimated( \
                widget, AnimationHover ) );
-                const qreal opacity( _animations->toolButtonEngine().opacity( \
widget, AnimationHover ) ); +                    // for menu arrows in flat \
toolbutton one uses animations to get the arrow color +                    // handle \
arrow over animation +                    const bool arrowHover( mouseOver && ( \
toolButtonOption->activeSubControls & SC_ToolButtonMenu ) ); +                    \
_animations->toolButtonEngine().updateState( widget, AnimationHover, arrowHover );  
-                color = _helper->arrowColor( palette, arrowHover, false, opacity, \
animated ? AnimationHover:AnimationNone ); +                    const bool animated( \
_animations->toolButtonEngine().isAnimated( widget, AnimationHover ) ); +             \
const qreal opacity( _animations->toolButtonEngine().opacity( widget, AnimationHover \
) );  
-            } else {
+                    color = _helper->arrowColor( palette, arrowHover, false, \
opacity, animated ? AnimationHover:AnimationNone );  
-                const bool sunken( state & (State_On | State_Sunken) );
-                if( flat )
-                {
+                }
 
-                    if( sunken && hasFocus && !mouseOver ) color = palette.color( \
                QPalette::HighlightedText );
-                    else color = _helper->arrowColor( palette, QPalette::WindowText \
); +            } else if( flat ) {
 
-                } else if( hasFocus && !mouseOver )  {
+                if( sunken && hasFocus && !mouseOver ) color = palette.color( \
QPalette::HighlightedText ); +                else color = _helper->arrowColor( \
palette, QPalette::WindowText );  
-                    color = palette.color( QPalette::HighlightedText );
+            } else if( hasFocus && !mouseOver )  {
 
-                } else {
+                color = palette.color( QPalette::HighlightedText );
 
-                    color = _helper->arrowColor( palette, QPalette::ButtonText );
+            } else {
+
+                color = _helper->arrowColor( palette, QPalette::ButtonText );
 
-                }
             }
 
         } else color = _helper->arrowColor( palette, QPalette::WindowText );
@@ -5972,7 +5973,6 @@ namespace Breeze
             return true;
         }
 
-
         // copy option and alter palette
         QStyleOptionToolButton copy( *toolButtonOption );
 
@@ -5988,7 +5988,6 @@ namespace Breeze
         // frame
         if( toolButtonOption->subControls & SC_ToolButton )
         {
-            copy.rect = buttonRect;
             if( inTabBar ) drawTabBarPanelButtonToolPrimitive( &copy, painter, \
                widget );
             else drawPrimitive( PE_PanelButtonTool, &copy, painter, widget);
         }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic