diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2017-06-19 16:26:45 -0400 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2017-06-20 02:30:05 +0000 |
commit | 7da750c49ffaae68bc1a0ec79781339dfad2d1e8 (patch) | |
tree | c1092b639d3a99f78d6dacaf14d97d4f4c458513 | |
parent | 1c4b185198ca798b4a27c7213da18b379c919804 (diff) | |
download | wireshark-7da750c49ffaae68bc1a0ec79781339dfad2d1e8.tar.gz |
Qt: Turn off auto scroll when going to a packet
When going to a packet (first, last, next, prev and specific) during
capture we must turn off auto scroll to let the packet be shown
in the packet list.
Change-Id: If1c615eb4d422c3b4c0418114064f7a4a0b75b35
Reviewed-on: https://code.wireshark.org/review/22244
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
(cherry picked from commit be4dbf840b164ab9b788ee8c3a9466e2da1393d2)
Reviewed-on: https://code.wireshark.org/review/22259
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
-rw-r--r-- | ui/qt/packet_list.cpp | 17 | ||||
-rw-r--r-- | ui/qt/packet_list.h | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 25dbb5bcea..d48c834c70 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -1181,6 +1181,8 @@ void PacketList::goNextPacket(void) // First visible packet. setCurrentIndex(indexAt(viewport()->rect().topLeft())); } + + scrollViewChanged(false); } void PacketList::goPreviousPacket(void) @@ -1202,18 +1204,24 @@ void PacketList::goPreviousPacket(void) goLastPacket(); } } + + scrollViewChanged(false); } void PacketList::goFirstPacket(void) { if (packet_list_model_->rowCount() < 1) return; setCurrentIndex(packet_list_model_->index(0, 0)); scrollTo(currentIndex()); + + scrollViewChanged(false); } void PacketList::goLastPacket(void) { if (packet_list_model_->rowCount() < 1) return; setCurrentIndex(packet_list_model_->index(packet_list_model_->rowCount() - 1, 0)); scrollTo(currentIndex()); + + scrollViewChanged(false); } // XXX We can jump to the wrong packet if a display filter is applied @@ -1223,6 +1231,8 @@ void PacketList::goToPacket(int packet) { if (row >= 0) { setCurrentIndex(packet_list_model_->index(row, 0)); } + + scrollViewChanged(false); } void PacketList::goToPacket(int packet, int hf_id) @@ -1592,8 +1602,13 @@ void PacketList::vScrollBarActionTriggered(int) // past the end. tail_at_end_ = (verticalScrollBar()->sliderPosition() >= verticalScrollBar()->maximum()); + scrollViewChanged(tail_at_end_); +} + +void PacketList::scrollViewChanged(bool at_end) +{ if (capture_in_progress_ && prefs.capture_auto_scroll) { - emit packetListScrolled(tail_at_end_); + emit packetListScrolled(at_end); } } diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h index 9bb2139a1f..68b2f1a182 100644 --- a/ui/qt/packet_list.h +++ b/ui/qt/packet_list.h @@ -146,6 +146,7 @@ private: void initHeaderContextMenu(); void drawCurrentPacket(); void applyRecentColumnWidths(); + void scrollViewChanged(bool at_end); signals: void packetDissectionChanged(); |