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.
This commit is contained in:
Augustin Cavalier
2020-05-12 21:57:37 -04:00
parent 194b772d8c
commit 9585fabd61
+3 -2
View File
@@ -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();
}
}