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

List:       kde-commits
Subject:    [breeze] kstyle: honor showIconsInMenuItems
From:       Hugo Pereira Da Costa <hugo.pereira () free ! fr>
Date:       2015-12-29 19:39:10
Message-ID: E1aE06w-00047h-Az () scm ! kde ! org
[Download RAW message or body]

Git commit 1ea115411f2492145db0531ee5792c9bf563df13 by Hugo Pereira Da Costa.
Committed on 29/12/2015 at 19:37.
Pushed by hpereiradacosta into branch 'master'.

honor showIconsInMenuItems

M  +14   -3    kstyle/breezestyle.cpp
M  +3    -0    kstyle/breezestyle.h

http://commits.kde.org/breeze/1ea115411f2492145db0531ee5792c9bf563df13

diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp
index ac41153..511396a 100644
--- a/kstyle/breezestyle.cpp
+++ b/kstyle/breezestyle.cpp
@@ -2691,7 +2691,9 @@ namespace Breeze
             case QStyleOptionMenuItem::SubMenu:
             {
 
-                const int iconWidth( isQtQuickControl( option, widget ) ? qMax( \
pixelMetric(PM_SmallIconSize, option, widget ), menuItemOption->maxIconWidth ) : \
menuItemOption->maxIconWidth ); +                int iconWidth = 0;
+                if( showIconsInMenuItems() ) iconWidth = isQtQuickControl( option, \
widget ) ? qMax( pixelMetric(PM_SmallIconSize, option, widget ), \
menuItemOption->maxIconWidth ) : menuItemOption->maxIconWidth; +
                 int leftColumnWidth( iconWidth );
 
                 // add space with respect to text
@@ -4575,12 +4577,14 @@ namespace Breeze
         }
 
         // icon
-        const int iconWidth( isQtQuickControl( option, widget ) ? qMax( \
pixelMetric(PM_SmallIconSize, option, widget ), menuItemOption->maxIconWidth ) : \
menuItemOption->maxIconWidth ); +        int iconWidth = 0;
+        const bool showIcon( showIconsInMenuItems() );
+        if( showIcon ) iconWidth = isQtQuickControl( option, widget ) ? qMax( \
pixelMetric(PM_SmallIconSize, option, widget ), menuItemOption->maxIconWidth ) : \
menuItemOption->maxIconWidth;  
         QRect iconRect( contentsRect.left(), contentsRect.top() + \
                (contentsRect.height()-iconWidth)/2, iconWidth, iconWidth );
         contentsRect.setLeft( iconRect.right() + Metrics::MenuItem_ItemSpacing + 1 \
);  
-        if( !menuItemOption->icon.isNull() )
+        if( showIcon && !menuItemOption->icon.isNull() )
         {
 
             const QSize iconSize( pixelMetric( PM_SmallIconSize, option, widget ), \
pixelMetric( PM_SmallIconSize, option, widget ) ); @@ -6836,6 +6840,13 @@ namespace \
Breeze  }
 
     //____________________________________________________________________
+    bool Style::showIconsInMenuItems( void ) const
+    {
+        const KConfigGroup g(KSharedConfig::openConfig(), "KDE");
+        return g.readEntry("ShowIconsInMenuItems", true);
+    }
+
+    //____________________________________________________________________
     bool Style::showIconsOnPushButtons( void ) const
     {
         const KConfigGroup g(KSharedConfig::openConfig(), "KDE");
diff --git a/kstyle/breezestyle.h b/kstyle/breezestyle.h
index 857c5d9..a627252 100644
--- a/kstyle/breezestyle.h
+++ b/kstyle/breezestyle.h
@@ -457,6 +457,9 @@ namespace Breeze
         //* return true if one of the widget's parent inherits requested type
         template<typename T> bool hasParent( const QWidget* ) const;
 
+        //* return true if icons should be shown in menus
+        bool showIconsInMenuItems( void ) const;
+
         //* return true if icons should be shown on buttons
         bool showIconsOnPushButtons( void ) const;
 


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

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