X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/c68f1f6f8d6c24123c9c5df4d2e91a9d2462ceb6..47014b26b84684bc08ea983143f8eb99c310622b:/src/kitemviews/kitemlistview.cpp diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 239e399a4..eb74b9655 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -77,7 +77,6 @@ KItemListView::KItemListView(QGraphicsWidget* parent) : m_visibleItems(), m_visibleGroups(), m_visibleCells(), - m_sizeHintResolver(nullptr), m_layouter(nullptr), m_animation(nullptr), m_oldScrollOffset(0), @@ -93,7 +92,8 @@ KItemListView::KItemListView(QGraphicsWidget* parent) : m_header(nullptr), m_headerWidget(nullptr), m_indicatorAnimation(nullptr), - m_dropIndicator() + m_dropIndicator(), + m_sizeHintResolver(nullptr) { setAcceptHoverEvents(true); setAcceptTouchEvents(true); @@ -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