]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Animation finetuning
authorPeter Penz <peter.penz19@gmail.com>
Fri, 16 Dec 2011 22:55:48 +0000 (23:55 +0100)
committerPeter Penz <peter.penz19@gmail.com>
Fri, 16 Dec 2011 22:57:33 +0000 (23:57 +0100)
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.

src/kitemviews/kitemlistview.cpp

index bda559d2c499578a7c7e3e0aafb5426fe4eabde6..20a5f4847c897f99353f9b5eed77c2a2c89e57a8 100644 (file)
@@ -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());