D10438: reserve space for checkable widgets in menu items

Vlad Zagorodniy noreply at phabricator.kde.org
Tue Feb 13 15:51:54 UTC 2018


zzag added a comment.


  Alright here's a patch which would make possible to turn off reserving space. Yet, a checkbox should be added in "Fine tuning" tab.
  
    From 45be224b2fb31966a3117aa1f226f8ea711f8109 Mon Sep 17 00:00:00 2001
    From: Vlad Zagorodniy <vladzzag at gmail.com>
    Date: Tue, 13 Feb 2018 17:44:43 +0200
    Subject: [PATCH] add reserve space from checkboxes option
    
    ---
     kstyle/breezestyle.cpp | 20 +++++++++++++++++---
     kstyle/breezestyle.h   |  3 +++
     2 files changed, 20 insertions(+), 3 deletions(-)
    
    diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp
    index 07f0be7d..02189575 100644
    --- a/kstyle/breezestyle.cpp
    +++ b/kstyle/breezestyle.cpp
    @@ -2728,7 +2728,11 @@ namespace Breeze
                     leftColumnWidth += Metrics::MenuItem_ItemSpacing;
     
                     // add checkbox indicator width
    -                leftColumnWidth += Metrics::CheckBox_Size + Metrics::MenuItem_ItemSpacing;
    +                if( menuItemOption->menuHasCheckableItems || reserveSpaceForCheckboxesInMenus() )
    +                {
    +                    leftColumnWidth += Metrics::CheckBox_Size
    +                                    +  Metrics::MenuItem_ItemSpacing;
    +                }
     
                     // add spacing for accelerator
                     /*
    @@ -4697,8 +4701,11 @@ namespace Breeze
             // define relevant rectangles
             // checkbox
             QRect checkBoxRect;
    -        checkBoxRect = QRect( contentsRect.left(), contentsRect.top() + (contentsRect.height()-Metrics::CheckBox_Size)/2, Metrics::CheckBox_Size, Metrics::CheckBox_Size );
    -        contentsRect.setLeft( checkBoxRect.right() + Metrics::MenuItem_ItemSpacing + 1 );
    +        if( menuItemOption->menuHasCheckableItems || reserveSpaceForCheckboxesInMenus() )
    +        {
    +            checkBoxRect = QRect( contentsRect.left(), contentsRect.top() + (contentsRect.height()-Metrics::CheckBox_Size)/2, Metrics::CheckBox_Size, Metrics::CheckBox_Size );
    +            contentsRect.setLeft( checkBoxRect.right() + Metrics::MenuItem_ItemSpacing + 1 );
    +        }
     
             // render checkbox indicator
             if( menuItemOption->checkType == QStyleOptionMenuItem::NonExclusive )
    @@ -7074,6 +7081,13 @@ namespace Breeze
             return g.readEntry("ShowIconsInMenuItems", true);
         }
     
    +    //____________________________________________________________________
    +    bool Style::reserveSpaceForCheckboxesInMenus() const
    +    {
    +        const KConfigGroup g(KSharedConfig::openConfig(), "KDE");
    +        return g.readEntry("ReserveSpaceForCheckboxesInMenus", true);
    +    }
    +
         //____________________________________________________________________
         bool Style::showIconsOnPushButtons() const
         {
    diff --git a/kstyle/breezestyle.h b/kstyle/breezestyle.h
    index 12548c92..031a1225 100644
    --- a/kstyle/breezestyle.h
    +++ b/kstyle/breezestyle.h
    @@ -468,6 +468,9 @@ namespace Breeze
             //* return true if icons should be shown in menus
             bool showIconsInMenuItems() const;
     
    +        //* return true if space is reserved for checkboxes in menus
    +        bool reserveSpaceForCheckboxesInMenus() const;
    +
             //* return true if icons should be shown on buttons
             bool showIconsOnPushButtons() const;
     
    -- 
    2.16.1
  
  But, I would like to have D10480 <https://phabricator.kde.org/D10480> in master so I could complete the patch above.

REPOSITORY
  R31 Breeze

REVISION DETAIL
  https://phabricator.kde.org/D10438

To: zzag, #breeze, #vdg, ngraham, hpereiradacosta
Cc: alake, colomar, januz, fabianr, mmustac, abetts, anemeth, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180213/4d775fd9/attachment-0001.html>


More information about the Plasma-devel mailing list