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>
This commit is contained in:
Stig Bjørlykke 2017-06-19 16:26:45 -04:00 committed by Anders Broman
parent 4e46352657
commit be4dbf840b
2 changed files with 17 additions and 1 deletions

View File

@ -1188,6 +1188,8 @@ void PacketList::goNextPacket(void)
// First visible packet.
setCurrentIndex(indexAt(viewport()->rect().topLeft()));
}
scrollViewChanged(false);
}
void PacketList::goPreviousPacket(void)
@ -1209,18 +1211,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
@ -1230,6 +1238,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)
@ -1599,8 +1609,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);
}
}

View File

@ -146,6 +146,7 @@ private:
void initHeaderContextMenu();
void drawCurrentPacket();
void applyRecentColumnWidths();
void scrollViewChanged(bool at_end);
signals:
void packetDissectionChanged();