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 <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Pascal Quantin 2015-11-27 17:01:05 +01:00
parent 62b03da49a
commit 56625dd456
3 changed files with 6 additions and 5 deletions

View File

@ -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<live capture in progress>" 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() {

View File

@ -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_) {

View File

@ -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();