D10480: align checkable widgets in menu items

Vlad Zagorodniy noreply at phabricator.kde.org
Tue Feb 13 14:38:09 UTC 2018


zzag added a comment.


  > this is because you have to rely on maxIconWidth, even if the current item has no icon, when computing the checkbox space.
  
  I've came up with something like this
  
    if( showIcon && menuItemOption->maxIconWidth > 0 )
    {
        int dx = (iconRect.left() - Metrics::CheckBox_Size) / 2;
        checkBoxRect.moveLeft( dx );
    } else {
        int dx = (textRect.left() - Metrics::CheckBox_Size) / 2;
        checkBoxRect.moveLeft( dx );
    }
  
  so, it centers properly checkboxes in menu items with and without icons
  
  F5709869: f.png <https://phabricator.kde.org/F5709869>
  
  F5709874: g.png <https://phabricator.kde.org/F5709874>
  
  //(it can be simplified with a ternary operator)//
  
  is it a good approach?

REPOSITORY
  R31 Breeze

REVISION DETAIL
  https://phabricator.kde.org/D10480

To: zzag, #breeze, #vdg, hpereiradacosta
Cc: plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180213/4797e3f5/attachment-0001.html>


More information about the Plasma-devel mailing list