Commit f697b073 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

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
parent 336cf7b6
......@@ -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,
......
......@@ -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 );
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment