From 03415d90783979f8e51880b7950721985fee29bf Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Wed, 8 Feb 2012 17:45:22 +0100 Subject: Layout optimizations - Differ internally between margins and paddings - Add a small padding in the icons-view and the compact-views - Optimize the width of the icons-view if previews are shown --- src/kitemviews/kitemlistview.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/kitemviews/kitemlistview.h') diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 50d8908e5..808ff5b3e 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -463,7 +463,9 @@ private: * the new grid- and item-size. Used to determine whether an animation * should be done when applying the new layout. */ - bool changesItemGridLayout(const QSizeF& newGridSize, const QSizeF& newItemSize) const; + bool changesItemGridLayout(const QSizeF& newGridSize, + const QSizeF& newItemSize, + const QSizeF& newItemMargin) const; /** * @param changedItemCount Number of inserted or removed items. @@ -497,6 +499,13 @@ private: * value != 0 will be returned. */ static int calculateAutoScrollingIncrement(int pos, int range, int oldInc); + + /** + * Helper functions for changesItemCount(). + * @return The number of items that fit into the available size by + * respecting the size of the item and the margin between the items. + */ + static int itemsPerSize(qreal size, qreal itemSize, qreal itemMargin); private: bool m_enabledSelectionToggles; -- cgit v1.3