┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistviewlayouter.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-10-24 00:22:03 +0200
committerPeter Penz <[email protected]>2011-10-24 00:22:27 +0200
commit54b5a283765f168575f2eaeff95c93dbeca3d63d (patch)
tree2cb153973acbc55ddbcb8be31036e1f124de07ed /src/kitemviews/kitemlistviewlayouter.cpp
parent517ebd721e12e3a4a3430ac3cba8ce99b33c5b0e (diff)
Make group-headers less ugly
Diffstat (limited to 'src/kitemviews/kitemlistviewlayouter.cpp')
-rw-r--r--src/kitemviews/kitemlistviewlayouter.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/kitemviews/kitemlistviewlayouter.cpp b/src/kitemviews/kitemlistviewlayouter.cpp
index 6bd9a6e27..9b807aaf5 100644
--- a/src/kitemviews/kitemlistviewlayouter.cpp
+++ b/src/kitemviews/kitemlistviewlayouter.cpp
@@ -355,6 +355,25 @@ void KItemListViewLayouter::doLayout()
m_itemRects.append(bounds);
}
+ if (grouped && horizontalScrolling) {
+ // When grouping is enabled in the horizontal mode, the header alignment
+ // looks like this:
+ // Header-1 Header-2 Header-3
+ // Item 1 Item 4 Item 7
+ // Item 2 Item 5 Item 8
+ // Item 3 Item 6 Item 9
+ // In this case 'requiredItemHeight' represents the column-width. We don't
+ // check the content of the header in the layouter to determine the required
+ // width, hence assure that at least a minimal width of 15 characters is given
+ // (in average a character requires the halve width of the font height).
+ //
+ // TODO: Let the group headers provide a minimum width and respect this width here
+ const qreal minimumGroupHeaderWidth = m_groupHeaderHeight * 15 / 2;
+ if (requiredItemHeight < minimumGroupHeaderWidth) {
+ requiredItemHeight = minimumGroupHeaderWidth;
+ }
+ }
+
maxItemHeight = qMax(maxItemHeight, requiredItemHeight);
x += m_columnWidth;
++index;