From f697b07340f3654f3a9242d94206211ea2f3e2be Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Tue, 13 Feb 2018 01:48:58 +0200 Subject: [PATCH] align checkable widgets in menu items Summary: Before {F5714193, layout=center, size=full} After {F5714196, layout=center, size=full} Test Plan: * open a context menu with icons and check boxes Reviewers: #breeze, #vdg, hpereiradacosta Reviewed By: hpereiradacosta Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D10480 --- kstyle/breeze.h | 3 ++- kstyle/breezestyle.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/kstyle/breeze.h b/kstyle/breeze.h index a20841bf..bc63e4c4 100644 --- a/kstyle/breeze.h +++ b/kstyle/breeze.h @@ -67,7 +67,8 @@ namespace Breeze // menu items Menu_FrameWidth = 0, - MenuItem_MarginWidth = 3, + MenuItem_MarginWidth = 5, + MenuItem_MarginHeight = 3, MenuItem_ItemSpacing = 4, MenuItem_AcceleratorSpace = 16, MenuButton_IndicatorWidth = 20, diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index fbe020b1..cb0d3e8b 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -2762,7 +2762,7 @@ namespace Breeze size.setHeight( qMax( size.height(), int(Metrics::MenuButton_IndicatorWidth) ) ); size.setHeight( qMax( size.height(), int(Metrics::CheckBox_Size) ) ); size.setHeight( qMax( size.height(), iconWidth ) ); - return expandSize( size, Metrics::MenuItem_MarginWidth ); + return expandSize( size, Metrics::MenuItem_MarginWidth, Metrics::MenuItem_MarginHeight ); } @@ -2772,7 +2772,7 @@ namespace Breeze if( menuItemOption->text.isEmpty() && menuItemOption->icon.isNull() ) { - return expandSize( QSize(0,1), Metrics::MenuItem_MarginWidth ); + return expandSize( QSize(0,1), Metrics::MenuItem_MarginWidth, Metrics::MenuItem_MarginHeight ); } else { @@ -4710,7 +4710,7 @@ namespace Breeze } // get rect available for contents - auto contentsRect( insideMargin( rect, Metrics::MenuItem_MarginWidth ) ); + auto contentsRect( insideMargin( rect, Metrics::MenuItem_MarginWidth, Metrics::MenuItem_MarginHeight ) ); // define relevant rectangles // checkbox @@ -6680,12 +6680,12 @@ namespace Breeze // render a separator at the bottom const auto& palette( option->palette ); const auto color( _helper->separatorColor( palette ) ); - _helper->renderSeparator( painter, QRect( option->rect.bottomLeft()-QPoint( 0, Metrics::MenuItem_MarginWidth), QSize( option->rect.width(), 1 ) ), color ); + _helper->renderSeparator( painter, QRect( option->rect.bottomLeft()-QPoint( 0, Metrics::MenuItem_MarginHeight), QSize( option->rect.width(), 1 ) ), color ); // render text in the center of the rect // icon is discarded on purpose painter->setFont( option->font ); - const auto contentsRect = insideMargin( option->rect, Metrics::MenuItem_MarginWidth ); + const auto contentsRect = insideMargin( option->rect, Metrics::MenuItem_MarginWidth, Metrics::MenuItem_MarginHeight ); drawItemText( painter, contentsRect, Qt::AlignCenter, palette, true, option->text, QPalette::WindowText ); }