summarylogtreecommitdiffstats
path: root/1.patch
blob: 7dc0ce34dafbe04102e09531137d35211cc02605 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
From 295613dfc6bfe6c863c6bf95c6c1425bfc44ad13 Mon Sep 17 00:00:00 2001
From: Pavel Antonov <pvantonov@gmail.com>
Date: Wed, 27 Jan 2021 01:28:38 +0700
Subject: [PATCH 1/2] Disable menu item's icon if item is checkable

---
 kstyle/breezestyle.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp
index 546cac1a..16fac2ab 100644
--- a/kstyle/breezestyle.cpp
+++ b/kstyle/breezestyle.cpp
@@ -2794,13 +2794,12 @@ namespace Breeze
 
                 int leftColumnWidth = 0;
 
-                // add icon width
-                if( iconWidth > 0 )
-                { leftColumnWidth += iconWidth + Metrics::MenuItem_ItemSpacing; }
-
                 // add checkbox indicator width
-                if( menuItemOption->menuHasCheckableItems )
+                if( menuItemOption->checkType != QStyleOptionMenuItem::NotCheckable )
                 { leftColumnWidth += Metrics::CheckBox_Size + Metrics::MenuItem_ItemSpacing; }
+                // add icon width
+                else if( iconWidth > 0 )
+                { leftColumnWidth += iconWidth + Metrics::MenuItem_ItemSpacing; }
 
                 // add spacing for accelerator
                 /*
@@ -4768,7 +4767,7 @@ namespace Breeze
         // define relevant rectangles
         // checkbox
         QRect checkBoxRect;
-        if( menuItemOption->menuHasCheckableItems )
+        if( menuItemOption->checkType != QStyleOptionMenuItem::NotCheckable )
         {
             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 );
@@ -4803,7 +4802,7 @@ namespace Breeze
 
         // icon
         int iconWidth = 0;
-        const bool showIcon( showIconsInMenuItems() );
+        const bool showIcon( showIconsInMenuItems() && menuItemOption->checkType == QStyleOptionMenuItem::NotCheckable);
         if( showIcon ) iconWidth = isQtQuickControl( option, widget ) ? qMax( pixelMetric(PM_SmallIconSize, option, widget ), menuItemOption->maxIconWidth ) : menuItemOption->maxIconWidth;
 
         QRect iconRect;
-- 
2.30.0


From d540de23bfba9beee1fc5b8f725469b7f1615eda Mon Sep 17 00:00:00 2001
From: Pavel Antonov <pvantonov@gmail.com>
Date: Wed, 27 Jan 2021 01:44:33 +0700
Subject: [PATCH 2/2] Disable items overlap with menu border

---
 kstyle/breezestyle.cpp | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp
index 16fac2ab..e2665c19 100644
--- a/kstyle/breezestyle.cpp
+++ b/kstyle/breezestyle.cpp
@@ -4711,9 +4711,9 @@ namespace Breeze
                 if( StyleConfigData::menuOpacity() < 100 ) 
                 {
                     color = _helper->alphaColor( palette.color( QPalette::WindowText ), 0.25 ) ;
-                    // don`t overlap with menu border
-                    copy.adjust( 1, 0, -1, 0 );
                 }
+                // don`t overlap with menu border
+                copy.adjust( 1, 0, -1, 0 );
                 
                 _helper->renderSeparator( painter, copy, color );
                 return true;
@@ -4725,6 +4725,8 @@ namespace Breeze
                  * in that case they are rendered as menu title buttons
                  */
                 QStyleOptionToolButton copy( separatorMenuItemOption( menuItemOption, widget ) );
+                // don`t overlap with menu border
+                copy.rect.adjust( 1, 0, -1, 0 );
                 renderMenuTitle( &copy, painter, widget );
 
                 return true;
@@ -4748,16 +4750,20 @@ namespace Breeze
             const auto color = _helper->focusColor( palette );
             const auto outlineColor = _helper->focusOutlineColor( palette );
 
+            QRect copy( rect );
+            // don`t overlap with menu border
+            copy.adjust( 1, 0, -1, 0 );
+            
             Sides sides = nullptr;
             if( !menuItemOption->menuRect.isNull() )
             {
-                if( rect.top() <= menuItemOption->menuRect.top() ) sides |= SideTop;
-                if( rect.bottom() >= menuItemOption->menuRect.bottom() ) sides |= SideBottom;
-                if( rect.left() <= menuItemOption->menuRect.left() ) sides |= SideLeft;
-                if( rect.right() >= menuItemOption->menuRect.right() ) sides |= SideRight;
+                if( copy.top() <= menuItemOption->menuRect.top() ) sides |= SideTop;
+                if( copy.bottom() >= menuItemOption->menuRect.bottom() ) sides |= SideBottom;
+                if( copy.left() <= menuItemOption->menuRect.left() ) sides |= SideLeft;
+                if( copy.right() >= menuItemOption->menuRect.right() ) sides |= SideRight;
             }
 
-            _helper->renderFocusRect( painter, rect, color, outlineColor, sides );
+            _helper->renderFocusRect( painter, copy, color, outlineColor, sides );
 
         }
 
-- 
2.30.0