Qt: Fix scrollbar vanishing when adding columns

Don't call resize in applyRecentColumnWidths(). It doesn't seem
to be necessary in Qt5 or Qt6 to stretch the packet list last column
when the main window is wider than the total columns, and it doesn't
seem to be necessary to get the horizontal scroll bar to appear if
the columns are wider than the window frame either.
(When adding and removing columns, resizing the main window, etc.,
the columns all behave as expected, including if the wide Info
column is removed).

Resizing the packet list makes the scrollbar (and minimap) disappear.
It reappears when selecting another packet, but since it's not
necessary to resize, don't.

Fix #13597
This commit is contained in:
John Thacker 2023-02-08 07:50:09 -05:00
parent bdc8c0c21a
commit a49c022773
1 changed files with 3 additions and 8 deletions

View File

@ -1132,24 +1132,19 @@ void PacketList::fieldsChanged(capture_file *cf)
// - Persist across freezes and thaws.
// - Persist across file closing and opening.
// - Save to recent when we save our profile (including shutting down).
// - Not be affected by the behavior of stretchLastSection.
// - Not be affected by the behavior of stretchLastSection. (XXX: We
// still save the stretched value to recent, sectionResized doesn't
// distinguish between a resize from being stretched and a manual change.)
void PacketList::applyRecentColumnWidths()
{
// Either we've just started up or a profile has changed. Read
// the recent settings, apply them, and save the header state.
int column_width = 0;
for (int col = 0; col < prefs.num_cols; col++) {
// The column must be shown before setting column width.
// Visibility will be updated in setColumnVisibility().
setColumnHidden(col, false);
setRecentColumnWidth(col);
column_width += columnWidth(col);
}
if (column_width > width()) {
resize(column_width, height());
}
column_state_ = header()->saveState();