diff options
author | Gerald Combs <gerald@zing.org> | 2015-12-06 12:08:52 -0800 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2015-12-07 13:58:18 +0000 |
commit | 5f00849b9769e7691832de56d1ee1bc9f846c6ed (patch) | |
tree | 684043e94d19c16c1f31a4b5be5d8c43221344a6 /ui/qt/packet_list.cpp | |
parent | ca9970cd27fc110eaa455c076038402314e4d95c (diff) | |
download | wireshark-5f00849b9769e7691832de56d1ee1bc9f846c6ed.tar.gz |
Qt: Set the packet list width when we apply recent column widths.
Instead of messing with stretchLastSection, simply widen the packet list
to the sum of our column widths. Do this whenever recent column widths
are applied instead of only when the packet list is shown.
Bug: 11849
Ping-Bug: 11738
Change-Id: If8f8c9a89da08387bbce38c663bbbe1d8f7e649a
Reviewed-on: https://code.wireshark.org/review/12455
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'ui/qt/packet_list.cpp')
-rw-r--r-- | ui/qt/packet_list.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index b1b665fc3b..0e409019e7 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -262,8 +262,6 @@ PacketList::PacketList(QWidget *parent) : setUniformRowHeights(true); setAccessibleName("Packet list"); - header()->setStretchLastSection(false); - overlay_sb_ = new OverlayScrollBar(Qt::Vertical, this); setVerticalScrollBar(overlay_sb_); @@ -432,17 +430,6 @@ PacketListModel *PacketList::packetListModel() const { void PacketList::showEvent (QShowEvent *) { setColumnVisibility(); - - int column_width = 0; - for (int col = 0; col < packet_list_model_->columnCount(); col++) { - column_width += columnWidth(col); - } - - if (column_width < viewport()->width()) { - header()->setStretchLastSection(true); - applyRecentColumnWidths(); - header()->setStretchLastSection(false); - } } void PacketList::selectionChanged (const QItemSelection & selected, const QItemSelection & deselected) { @@ -712,20 +699,25 @@ 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. // Called via recentFilesRead. void PacketList::applyRecentColumnWidths() { -// bool saved_stretch = header()->stretchLastSection(); -// header()->setStretchLastSection(false); - // 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++) { setRecentColumnWidth(col); + column_width += columnWidth(col); + } + + if (column_width > width()) { + resize(column_width, height()); } -// header()->setStretchLastSection(saved_stretch); column_state_ = header()->saveState(); } |