┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-12-16 23:55:48 +0100
committerPeter Penz <[email protected]>2011-12-16 23:57:33 +0100
commitfd60b81573f97fb2fd15ef359723c29912bedc94 (patch)
tree4f4f0004270d3dac875ec3978d921847ec455534 /src/kitemviews/kitemlistview.cpp
parentd0ba75d13e6887e43febfaf9d613db70f6297cd3 (diff)
Animation finetuning
If dynamic item sizes are used don't animate the size of the widget in along the dynamic direction. This prevents unnecessary animations when increasing the window width in combination with e.g. the details view.
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
-rw-r--r--src/kitemviews/kitemlistview.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp
index bda559d2c..20a5f4847 100644
--- a/src/kitemviews/kitemlistview.cpp
+++ b/src/kitemviews/kitemlistview.cpp
@@ -1385,7 +1385,17 @@ void KItemListView::doLayout(LayoutAnimationHint hint, int changedIndex, int cha
widget->setVisible(true);
if (widget->size() != itemBounds.size()) {
+ // Resize the widget for the item to the changed size.
if (animate) {
+ // If a dynamic item size is used then no animation is done in the direction
+ // of the dynamic size.
+ if (m_itemSize.width() <= 0) {
+ // The width is dynamic, apply the new width without animation.
+ widget->resize(itemBounds.width(), widget->size().height());
+ } else if (m_itemSize.height() <= 0) {
+ // The height is dynamic, apply the new height without animation.
+ widget->resize(widget->size().width(), itemBounds.height());
+ }
m_animation->start(widget, KItemListViewAnimation::ResizeAnimation, itemBounds.size());
} else {
widget->resize(itemBounds.size());