⛏️ index : haiku.git

author Augustin Cavalier <waddlesplash@gmail.com> 2020-05-12 21:57:37.0 -04:00:00
committer waddlesplash <waddlesplash@gmail.com> 2020-05-13 2:04:45.0 +00:00:00
commit
e256f75c0885cae4e484e44bee51eb0a6ae4c0aa [patch]
tree
39436201c2a889a9c7cd4870b128472312c01477
parent
8a5894da8245cd6f7f085c0965f6c29158505d77
download
e256f75c0885cae4e484e44bee51eb0a6ae4c0aa.tar.gz

BColumnListView: Consider current, not preferred, column width for overall preferred with.

Otherwise, the entire list will be scanned for row widths, which
is extremely slow with thousands of items, and may not be what
the user wants anyway, if they have set specific column sizes
which are larger/smaller than that.

Helps with #16012 and #15889 considerably.
(cherry picked from commit 9585fabd612d4c823ed9f9d20b15c4c12411895a)

Change-Id: I7414c2f0f69b1d791adf9d8186dbf1ff95a126fa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2688
Reviewed-by: waddlesplash <waddlesplash@gmail.com>

Diff

 src/kits/interface/ColumnListView.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/kits/interface/ColumnListView.cpp b/src/kits/interface/ColumnListView.cpp
index 763b0b4..73466db 100644
--- a/src/kits/interface/ColumnListView.cpp
+++ b/src/kits/interface/ColumnListView.cpp
@@ -1967,14 +1967,15 @@
		// Start with the extra width for border and scrollbars etc.
		size.width = titleRect.left - Bounds().left;
		size.width += Bounds().right - titleRect.right;
		// If we want all columns to be visible at their preferred width,

		// If we want all columns to be visible at their current width,
		// we also need to add the extra margin width that the TitleView
		// uses to compute its _VirtualWidth() for the horizontal scroll bar.
		size.width += fTitleView->MarginWidth();
		for (int32 i = 0; i < count; i++) {
			BColumn* column = ColumnAt(i);
			if (column != NULL)
				size.width += fOutlineView->GetColumnPreferredWidth(column);
				size.width += column->Width();
		}
	}