Commit 8989f8fd authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

reserve space for checkable widgets in menu items

Summary:
At a given moment, menu items do not have empty space on the left side.
This feels not really comfortable or "natural"(I don't know how to
express this feeling).

This revision tries to solve the problem above by reserving space for checkable
widgets. Also, it achieves consistency with macOS/Windows/Unity/etc.

Before

{F5704700, layout=center, size=full}

After

{F5708012, layout=center, size=full}

Context menus with checkable widgets(e.g. radio buttons or checkboxes) look the same

{F5708014, layout=center, size=full}

Test Plan: * open context menu

Reviewers: #breeze, #vdg, ngraham, hpereiradacosta

Reviewed By: hpereiradacosta

Subscribers: januz, fabianr, mmustac, abetts, anemeth, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10438
parent 6f418a7d
......@@ -2728,8 +2728,7 @@ namespace Breeze
leftColumnWidth += Metrics::MenuItem_ItemSpacing;
// add checkbox indicator width
if( menuItemOption->menuHasCheckableItems )
{ leftColumnWidth += Metrics::CheckBox_Size + Metrics::MenuItem_ItemSpacing; }
leftColumnWidth += Metrics::CheckBox_Size + Metrics::MenuItem_ItemSpacing;
// add spacing for accelerator
/*
......@@ -4698,11 +4697,8 @@ namespace Breeze
// define relevant rectangles
// checkbox
QRect checkBoxRect;
if( menuItemOption->menuHasCheckableItems )
{
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 );
}
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 )
......
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