File Always-reserve-space-for-icons.patch of Package kio.7470

From 31361267d41977047e2523ae95718b20713d0d6d Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Tue, 15 Aug 2017 10:17:29 +0200
Subject: KFileItemDelegate: Always reserve space for icons

Summary:
Even null icons are drawn so also reserve space for them to avoid overlapping.
BUG: 372207

Test Plan: http://imgur.com/a/fG2T0

Reviewers: #frameworks

Subscribers: #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D7318
---
 src/widgets/kfileitemdelegate.cpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/widgets/kfileitemdelegate.cpp b/src/widgets/kfileitemdelegate.cpp
index f18eb35..3dd8eb7 100644
--- a/src/widgets/kfileitemdelegate.cpp
+++ b/src/widgets/kfileitemdelegate.cpp
@@ -832,6 +832,7 @@ void KFileItemDelegate::Private::initStyleOption(QStyleOptionViewItem *option,
     }
 
     option->icon = decoration(*option, index);
+    // Note that even null icons are still drawn for alignment
     if (!option->icon.isNull()) {
         option->features |= QStyleOptionViewItemV2::HasDecoration;
     }
@@ -1094,10 +1095,6 @@ QIcon KFileItemDelegate::Private::decoration(const QStyleOptionViewItemV4 &option,
 
 QRect KFileItemDelegate::Private::labelRectangle(const QStyleOptionViewItemV4 &option) const
 {
-    if (option.icon.isNull()) {
-        return subtractMargin(option.rect, Private::ItemMargin);
-    }
-
     const QSize decoSize = addMargin(option.decorationSize, Private::IconMargin);
     const QRect itemRect = subtractMargin(option.rect, Private::ItemMargin);
     QRect textArea(QPoint(0, 0), itemRect.size());
-- 
cgit v0.11.2

openSUSE Build Service is sponsored by