From 56625dd4562d89f711ab68caa8cf849509b0970f Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Fri, 27 Nov 2015 17:01:05 +0100 Subject: [PATCH] Qt: remove automatic horizontal scrolling when selecting a row QTreeView automatically scrolls so as to show as much as possible the content of the selected column. Let's get rid of that. Rename PacketList::setAutoScroll() so that it does not overload QAbstractItemView::setAutoscroll() Change-Id: I09fb54f9b31c3025efddce6a4e709baaf107702d Reviewed-on: https://code.wireshark.org/review/12225 Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin --- ui/qt/main_window_slots.cpp | 6 +++--- ui/qt/packet_list.cpp | 3 ++- ui/qt/packet_list.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 8c84ce4b87..b9fd0a8cdc 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -812,7 +812,7 @@ void MainWindow::startCapture() { GString *interface_names; /* enable autoscroll timer as needed. */ - packet_list_->setAutoScroll(main_ui_->actionGoAutoScroll->isChecked()); + packet_list_->setVerticalAutoScroll(main_ui_->actionGoAutoScroll->isChecked()); /* Add "interface name" on main status bar */ interface_names = get_iface_list_string(capture_opts, 0); @@ -927,7 +927,7 @@ void MainWindow::stopCapture() { main_ui_->statusBar->setFileName(capture_file_); /* disable autoscroll timer if any. */ - packet_list_->setAutoScroll(false); + packet_list_->setVerticalAutoScroll(false); } // Keep focus rects from showing through the welcome screen. Primarily for @@ -3342,7 +3342,7 @@ void MainWindow::on_actionGoPreviousConversationPacket_triggered() void MainWindow::on_actionGoAutoScroll_toggled(bool checked) { - packet_list_->setAutoScroll(checked); + packet_list_->setVerticalAutoScroll(checked); } void MainWindow::resetPreviousFocus() { diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 60fadf6d7a..3b39b00c60 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -260,6 +260,7 @@ PacketList::PacketList(QWidget *parent) : setRootIsDecorated(false); setSortingEnabled(true); setUniformRowHeights(true); + setAutoScroll(false); setAccessibleName("Packet list"); overlay_sb_ = new OverlayScrollBar(Qt::Vertical, this); @@ -754,7 +755,7 @@ void PacketList::recolorPackets() /* Enable autoscroll timer. Note: must be called after the capture is started, * otherwise the timer will not be executed. */ -void PacketList::setAutoScroll(bool enabled) +void PacketList::setVerticalAutoScroll(bool enabled) { tail_at_end_ = enabled; if (enabled && capture_in_progress_) { diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h index f0786a5ecc..5a863d2db9 100644 --- a/ui/qt/packet_list.h +++ b/ui/qt/packet_list.h @@ -71,7 +71,7 @@ public: QString packetComment(); void setPacketComment(QString new_comment); QString allPacketComments(); - void setAutoScroll(bool enabled = true); + void setVerticalAutoScroll(bool enabled = true); void setCaptureInProgress(bool in_progress = false) { capture_in_progress_ = in_progress; tail_at_end_ = in_progress; } void captureFileReadFinished();