From 9585fabd612d4c823ed9f9d20b15c4c12411895a Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 12 May 2020 21:57:37 -0400 Subject: [PATCH] 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. --- 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 763b0b421a..73466dbf5a 100644 --- a/src/kits/interface/ColumnListView.cpp +++ b/src/kits/interface/ColumnListView.cpp @@ -1967,14 +1967,15 @@ BColumnListView::PreferredSize() // 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(); } }