]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistview.cpp
Merge branch 'release/22.04'
[dolphin.git] / src / kitemviews / kitemlistview.cpp
index 239e399a45b9060701bb4adb5a65177701d12f33..562a45e1877a2e22be67d09b295b0862b4abd495 100644 (file)
@@ -1858,6 +1858,8 @@ void KItemListView::doLayout(LayoutAnimationHint hint, int changedIndex, int cha
         Q_ASSERT(widget->index() == i);
         widget->setVisible(true);
 
+        bool animateIconResizing = animate;
+
         if (widget->size() != itemBounds.size()) {
             // Resize the widget for the item to the changed size.
             if (animate) {
@@ -1874,11 +1876,13 @@ void KItemListView::doLayout(LayoutAnimationHint hint, int changedIndex, int cha
             } else {
                 widget->resize(itemBounds.size());
             }
+        } else {
+            animateIconResizing = false;
         }
 
         const int newIconSize = widget->styleOption().iconSize;
         if (widget->iconSize() != newIconSize) {
-            if (animate) {
+            if (animateIconResizing) {
                 m_animation->start(widget, KItemListViewAnimation::IconResizeAnimation, newIconSize);
             } else {
                 widget->setIconSize(newIconSize);
@@ -2405,7 +2409,9 @@ void KItemListView::applyAutomaticColumnWidths()
     qreal firstColumnWidth = m_headerWidget->columnWidth(firstRole);
     QSizeF dynamicItemSize = m_itemSize;
 
-    qreal requiredWidth = columnWidthsSum() + m_headerWidget->leadingPadding();
+    qreal requiredWidth = columnWidthsSum() + m_headerWidget->leadingPadding()
+        + m_headerWidget->leadingPadding(); // Adding the padding a second time so we have the same padding symmetrically on both sides of the view.
+        // This improves UX, looks better and increases the chances of users figuring out that the padding area can be used for deselecting and dropping files.
     const qreal availableWidth = size().width();
     if (requiredWidth < availableWidth) {
         // Stretch the first column to use the whole remaining width