Qt: Clear selection, not current, in drawCurrentPacket

QItemSelectionModel tracks both the selected index and the
current index.

PacketList redraws when the *selected* index changes, not
the current index. Clearing the current index, and then marking
the same packet as selected and current fires currentChanged but
not selectionChanged. So drawCurrentPacket needs to call
clearSelection(), not clearCurrentIndex(), in order to trigger
a redissection of the currently selected packet and update
the packet details.

For example, if you mark or unmark the currently selected frame,
this causes the packet details to update. Cf 52955b9c43,
which fixed the same issue but for Find Packet.

Fix #14330.
This commit is contained in:
John Thacker 2023-01-19 19:41:07 -05:00
parent c380f516a2
commit 199ecf2983
1 changed files with 1 additions and 1 deletions

View File

@ -1031,7 +1031,7 @@ void PacketList::drawCurrentPacket()
{
QModelIndex current_index = currentIndex();
if (selectionModel() && current_index.isValid()) {
selectionModel()->clearCurrentIndex();
selectionModel()->clearSelection();
selectionModel()->setCurrentIndex(current_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
}
}