diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index a3b37d85ed3271bcf89ebfec5ae78f1a805d0e7d..a46cf530b1489e94092c46cc9cee6e3a55108e55 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -206,7 +206,8 @@ PacketList::PacketList(QWidget *parent) : rows_inserted_(false), columns_changed_(false), set_column_visibility_(false), - frozen_rows_(QModelIndexList()), + frozen_current_row_(QModelIndex()), + frozen_selected_rows_(QModelIndexList()), cur_history_(-1), in_history_(false), finfo_array(NULL) @@ -1236,7 +1237,8 @@ void PacketList::freeze() { column_state_ = header()->saveState(); setHeaderHidden(true); - frozen_rows_ = selectedIndexes(); + frozen_current_row_ = currentIndex(); + frozen_selected_rows_ = selectedIndexes(); selectionModel()->clear(); setModel(Q_NULLPTR); // It looks like GTK+ sends a cursor-changed signal at this point but Qt doesn't @@ -1260,16 +1262,18 @@ void PacketList::thaw(bool restore_selection) // resized the columns manually since they were initially loaded. header()->restoreState(column_state_); - if (restore_selection && frozen_rows_.length() > 0 && selectionModel()) { + if (restore_selection && frozen_selected_rows_.length() > 0 && selectionModel()) { /* This updates our selection, which redissects the current packet, * which is needed when we're called from MainWindow::layoutPanes. * Also, this resets all ProtoTree and ByteView data */ clearSelection(); - foreach (QModelIndex idx, frozen_rows_) { + setCurrentIndex(frozen_current_row_); + foreach (QModelIndex idx, frozen_selected_rows_) { selectionModel()->select(idx, QItemSelectionModel::Select | QItemSelectionModel::Rows); } } - frozen_rows_ = QModelIndexList(); + frozen_current_row_ = QModelIndex(); + frozen_selected_rows_ = QModelIndexList(); } void PacketList::clear() { diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h index 3a1655180894399e40e3d177f909bb6f2473d09f..8e832e1970c5eb59d06ed304ad7ad3c3588a5bd9 100644 --- a/ui/qt/packet_list.h +++ b/ui/qt/packet_list.h @@ -140,7 +140,8 @@ private: bool rows_inserted_; bool columns_changed_; bool set_column_visibility_; - QModelIndexList frozen_rows_; + QModelIndex frozen_current_row_; + QModelIndexList frozen_selected_rows_; QVector<int> selection_history_; int cur_history_; bool in_history_;