┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.cpp
diff options
context:
space:
mode:
authorAmol Godbole <[email protected]>2023-09-03 12:15:31 -0500
committerAmol Godbole <[email protected]>2023-09-05 04:58:05 +0000
commit385146a1e8bd6762af9945756cc27e5a46b4f98a (patch)
tree434f27d8cfb2f44c4c197dd737c07142008c42be /src/kitemviews/kitemlistview.cpp
parent6820273db0283dd80ecfa23880f06675ed5277ff (diff)
KItemListView: Fix inconsistencies in requiredWidth calculation
Commits d3839617 and 3bf471e0 introduced a few changes to requiredWidth calculation. This commit makes the calculation of requiredWidth consistent across KItemListView.
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
-rw-r--r--src/kitemviews/kitemlistview.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp
index 5363fa253..38d21ff5e 100644
--- a/src/kitemviews/kitemlistview.cpp
+++ b/src/kitemviews/kitemlistview.cpp
@@ -361,7 +361,7 @@ void KItemListView::setGeometry(const QRectF &rect)
if (m_headerWidget->automaticColumnResizing()) {
applyAutomaticColumnWidths();
} else {
- const qreal requiredWidth = columnWidthsSum();
+ const qreal requiredWidth = columnWidthsSum() + 2 * m_headerWidget->sidePadding();
const QSizeF dynamicItemSize(qMax(newSize.width(), requiredWidth), m_itemSize.height());
m_layouter->setItemSize(dynamicItemSize);
}
@@ -2280,7 +2280,7 @@ QHash<QByteArray, qreal> KItemListView::preferredColumnWidths(const KItemRangeLi
void KItemListView::applyColumnWidthsFromHeader()
{
// Apply the new size to the layouter
- const qreal requiredWidth = columnWidthsSum() + m_headerWidget->sidePadding();
+ const qreal requiredWidth = columnWidthsSum() + 2 * m_headerWidget->sidePadding();
const QSizeF dynamicItemSize(qMax(size().width(), requiredWidth), m_itemSize.height());
m_layouter->setItemSize(dynamicItemSize);
@@ -2375,9 +2375,9 @@ void KItemListView::applyAutomaticColumnWidths()
qreal firstColumnWidth = m_headerWidget->columnWidth(firstRole);
QSizeF dynamicItemSize = m_itemSize;
- qreal requiredWidth = columnWidthsSum() + m_headerWidget->sidePadding()
- + m_headerWidget->sidePadding(); // 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.
+ qreal requiredWidth = columnWidthsSum() + 2 * m_headerWidget->sidePadding(); // 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