diff options
Diffstat (limited to '1.patch')
-rw-r--r-- | 1.patch | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/1.patch b/1.patch new file mode 100644 index 000000000000..7dc0ce34dafb --- /dev/null +++ b/1.patch @@ -0,0 +1,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( ©, 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 + |