From 7d7175a1308d914495bba5cde27e5bd2715d8644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Sun, 9 Sep 2018 20:30:54 +0200 Subject: Qt: Restore column visibility when loading packets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Always restore column visibility when loading packets to avoid some situations where the column hidden state was incorrect. This fixes the following scenario: - Apply a column and hide it using the column popup menu - Apply another column and remove it using the column popup menu - Close and reopen the capture file - Observe the hidden column is shown, but with wrong width Change-Id: I00531907b2383c6605a2d62e8243092906037d0c Reviewed-on: https://code.wireshark.org/review/29516 Petri-Dish: Stig Bjørlykke Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke --- ui/qt/packet_list.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'ui/qt') diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 070b2d4a37..71f60f2bf1 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -1198,13 +1198,15 @@ void PacketList::deleteAllPacketComments() void PacketList::setCaptureFile(capture_file *cf) { - if (cf) { - // We're opening. Restore our column widths. - header()->restoreState(column_state_); - } cap_file_ = cf; - if (cap_file_ && columns_changed_) { - columnsChanged(); + if (cf) { + if (columns_changed_) { + columnsChanged(); + } else { + // Restore columns widths and visibility. + header()->restoreState(column_state_); + setColumnVisibility(); + } } packet_list_model_->setCaptureFile(cf); create_near_overlay_ = true; -- cgit v1.2.3