┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-02-01 13:46:24 +0100
committerPeter Penz <[email protected]>2012-02-01 15:33:27 +0100
commit39348650d5b1af9b7eca681f35259d9532c29156 (patch)
treebd409403ddd073f54655f39d2d9daa0e60e598ef /src/kitemviews/kitemlistview.h
parent530b91b9c738baece708e7fef730444d50ec9db0 (diff)
Don't animate items if the number of grid elements has been changed
Having animated items is useful when e.g. deleting or inserting one item or when the size or position slightly changes by increasing the zoom level or the window size. However if the number of rows or columns change, the animation gets obtrusive and in this case lets just apply the final layout.
Diffstat (limited to 'src/kitemviews/kitemlistview.h')
-rw-r--r--src/kitemviews/kitemlistview.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h
index 4455166dd..95215fffd 100644
--- a/src/kitemviews/kitemlistview.h
+++ b/src/kitemviews/kitemlistview.h
@@ -347,10 +347,13 @@ private:
/**
* Helper method for doLayout: Returns a list of items that can be reused for the visible
* area. Invisible group headers get recycled. The reusable items are items that are
- * invisible and not animated. Reusing items is faster in comparison to deleting invisible
+ * invisible. If the animation hint is 'Animation' then items that are currently animated
+ * won't be reused. Reusing items is faster in comparison to deleting invisible
* items and creating a new instance for visible items.
*/
- QList<int> recycleInvisibleItems(int firstVisibleIndex, int lastVisibleIndex);
+ QList<int> recycleInvisibleItems(int firstVisibleIndex,
+ int lastVisibleIndex,
+ LayoutAnimationHint hint);
/**
* Helper method for doLayout: Starts a moving-animation for the widget to the given
@@ -442,6 +445,21 @@ private:
* if no header is shown.
*/
QRectF headerBoundaries() const;
+
+ /**
+ * @return True if the number of columns or rows will be changed when applying
+ * 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;
+
+ /**
+ * @param changedItemCount Number of inserted or removed items.
+ * @return True if the inserting or removing of items should be animated.
+ * No animation should be done if the number of items is too large
+ * to provide a pleasant animation.
+ */
+ bool animateChangedItemCount(int changedItemCount) const;
/**
* Helper function for triggerAutoScrolling().