]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistgroupheader.cpp
Details view: Expand the name-column like in Dolphin 1.x
[dolphin.git] / src / kitemviews / kitemlistgroupheader.cpp
index ffc81eb120483be421f0052b19f7b059d3693141..bc68cd562c2f8f2836bcb64f27ca66a756637075 100644 (file)
@@ -131,15 +131,17 @@ void KItemListGroupHeader::paint(QPainter* painter, const QStyleOptionGraphicsIt
         updateCache();
     }
 
+    if (m_itemIndex == 0) {
+        // No top- or left-line should be drawn for the first group-header
+        return;
+    }
+
+    painter->setPen(m_lineColor);
+
     if (m_scrollOrientation == Qt::Horizontal) {
-        painter->setPen(m_lineColor);
-        const qreal x = m_roleBounds.x() - m_styleOption.padding;
-        painter->drawLine(x, 0, x, size().height() - 1);
-
-    } else if (m_itemIndex > 0) {
-        painter->setPen(m_lineColor);
-        const qreal y = m_roleBounds.y() - m_styleOption.padding;
-        painter->drawLine(0, y, size().width() - 1, y);
+        painter->drawLine(0, 0, 0, size().height() - 1);
+    } else {
+        painter->drawLine(0, 0, size().width() - 1, 0);
     }
 }
 
@@ -200,22 +202,19 @@ void KItemListGroupHeader::updateCache()
     const QColor c1 = m_styleOption.palette.text().color();
     const QColor c2 = m_styleOption.palette.base().color();
     m_lineColor = mixedColor(c1, c2, 10);
-    m_roleColor = mixedColor(c1, c2, 50);
+    m_roleColor = mixedColor(c1, c2, 70);
 
-    int horizontalMargin = 0;
-    if (m_scrollOrientation == Qt::Vertical) {
-        // The x-position of the group-header-widget will always be 0,
-        // Add a minimum margin.
-        horizontalMargin = qMax(2, m_styleOption.horizontalMargin);
-    }
+    const int padding = qMax(1, m_styleOption.padding);
+    const int horizontalMargin = qMax(2, m_styleOption.horizontalMargin);
 
-    const int padding = qMax(2, m_styleOption.padding);
     const QFontMetrics fontMetrics(m_styleOption.font);
     const qreal roleHeight = fontMetrics.height();
 
+    const int y = (m_scrollOrientation == Qt::Vertical) ? padding : horizontalMargin;
+
     m_roleBounds = QRectF(horizontalMargin + padding,
-                          size().height() - roleHeight - padding,
-                          size().width() - 2 * (horizontalMargin + padding),
+                          y,
+                          size().width() - 2 * padding - horizontalMargin,
                           roleHeight);
 
     m_dirtyCache = false;