D11650: Fix alignment of icons in Places panel and Compact view mode

Vlad Zagorodniy noreply at phabricator.kde.org
Wed Mar 28 00:41:26 BST 2018


zzag added a comment.


    From e1b181dc1974b2ca0e1ecad2135318d82bfc7d63 Mon Sep 17 00:00:00 2001
    From: Vlad Zagorodniy <vladzzag at gmail.com>
    Date: Wed, 28 Mar 2018 02:37:26 +0300
    Subject: [PATCH] kitemview/kstandarditemlistwidget: vertically align icons
    
    ---
     src/kitemviews/kstandarditemlistwidget.cpp | 6 ++++--
     1 file changed, 4 insertions(+), 2 deletions(-)
    
    diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
    index d396e58f8..c9a3fcc67 100644
    --- a/src/kitemviews/kstandarditemlistwidget.cpp
    +++ b/src/kitemviews/kstandarditemlistwidget.cpp
    @@ -1022,8 +1022,10 @@ void KStandardItemListWidget::updatePixmapCache()
             const TextInfo* textInfo = m_textInfo.value("text");
             m_pixmapPos.setX(textInfo->pos.x() - 2 * padding
                              - (scaledIconSize + m_scaledPixmapSize.width()) / 2);
    -        m_pixmapPos.setY(padding
    -                         + (scaledIconSize - m_scaledPixmapSize.height()) / 2);
    +        const qreal midlineShift = m_customizedFontMetrics.height() / 2.0
    +            - m_customizedFontMetrics.descent()
    +            - m_customizedFontMetrics.capHeight() / 2.0;
    +        m_pixmapPos.setY(m_textRect.center().y() + midlineShift - m_scaledPixmapSize.height() / 2.0);
         }
     
         m_iconRect = QRectF(m_pixmapPos, QSizeF(m_scaledPixmapSize));
    -- 
    2.16.3
  
  F5770140: aligned.png <https://phabricator.kde.org/F5770140>
  
  In D11650#235679 <https://phabricator.kde.org/D11650#235679>, @sharvey wrote:
  
  > I, too, love typography. What did you use to generate that sample?
  
  
  That's a simple demo app I built.
  
  > Between padded icons and questionable midlines... no wonder this "simple" fix became so complicated.
  
  No, that's simple(see the patch above). Feel free to copy it. ;-)

REPOSITORY
  R318 Dolphin

BRANCH
  arcpatch-D11650

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

To: sharvey, #dolphin, ngraham, cfeck
Cc: zzag, elvisangelaccio, #dolphin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20180327/c65f5285/attachment.htm>


More information about the kfm-devel mailing list