Qt: fix wrong default packet list order in Qt 5.13

Workaround a Qt 5.13 bug that made QTreeView::sortByColumn(-1)
ineffective and results in sorting rows by the first column in reverse
order.

This must be called before setModel since that already triggers sorting.

Bug: 15979
Change-Id: I86c26959d3cb9dd4118193dcda4b1308cc911290
Reviewed-on: https://code.wireshark.org/review/34226
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Peter Wu 2019-08-10 00:57:00 +01:00 committed by Roland Knall
parent 5750f24787
commit e1e41c0db5
1 changed files with 2 additions and 1 deletions

View File

@ -247,9 +247,10 @@ PacketList::PacketList(QWidget *parent) :
overlay_sb_ = new OverlayScrollBar(Qt::Vertical, this);
setVerticalScrollBar(overlay_sb_);
header()->setSortIndicator(-1, Qt::AscendingOrder);
packet_list_model_ = new PacketListModel(this, cap_file_);
setModel(packet_list_model_);
sortByColumn(-1, Qt::AscendingOrder);
Q_ASSERT(gbl_cur_packet_list == Q_NULLPTR);
gbl_cur_packet_list = this;