From a49c0227738eaa150ad77e38316ee186d368d0c4 Mon Sep 17 00:00:00 2001 From: John Thacker Date: Wed, 8 Feb 2023 07:50:09 -0500 Subject: [PATCH] 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 --- ui/qt/packet_list.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 40ab5ab3db..87988f7a39 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -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();