diff options
author | Gerald Combs <gerald@wireshark.org> | 2013-10-28 23:57:57 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2013-10-28 23:57:57 +0000 |
commit | 4e94bdcb8547f8e51d7bf6c575eb1ddc20bc291e (patch) | |
tree | 75e769980c8c9e04168ffef197585b63539d2473 /ui/qt/sequence_dialog.cpp | |
parent | 360c4fba2110876104508eb8a633640fe88f3151 (diff) | |
download | wireshark-4e94bdcb8547f8e51d7bf6c575eb1ddc20bc291e.tar.gz |
Fix scroll bar ranges.
svn path=/trunk/; revision=52937
Diffstat (limited to 'ui/qt/sequence_dialog.cpp')
-rw-r--r-- | ui/qt/sequence_dialog.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ui/qt/sequence_dialog.cpp b/ui/qt/sequence_dialog.cpp index 186d8dd9c9..2d0f91f036 100644 --- a/ui/qt/sequence_dialog.cpp +++ b/ui/qt/sequence_dialog.cpp @@ -60,10 +60,15 @@ SequenceDialog::SequenceDialog(QWidget *parent, capture_file *cf, SequenceType t sp->axisRect()->setRangeDragAxes(sp->xAxis2, sp->yAxis); sp->xAxis->setVisible(false); + sp->xAxis->setPadding(0); + sp->xAxis->setLabelPadding(0); + sp->xAxis->setTickLabelPadding(0); sp->xAxis2->setVisible(true); sp->yAxis2->setVisible(true); one_em_ = QFontMetrics(sp->yAxis->labelFont()).height(); + ui->horizontalScrollBar->setSingleStep(100 / one_em_); + ui->verticalScrollBar->setSingleStep(100 / one_em_); sp->setInteractions(QCP::iRangeDrag); @@ -240,10 +245,6 @@ void SequenceDialog::fillDiagram() } } node_label_w_ = (node_label_w_ * 3 / 4) + one_em_; -// ui->sequencePlot->rescaleAxes(); - - ui->horizontalScrollBar->setRange(0, seq_analysis_.num_nodes * 100); - ui->verticalScrollBar->setRange(0, (num_items_ + 1) * 100); mouseMoved(NULL); resetAxes(); @@ -255,7 +256,8 @@ void SequenceDialog::fillDiagram() void SequenceDialog::resetAxes(bool keep_lower) { QCustomPlot *sp = ui->sequencePlot; - double top_pos = -1.0, left_pos = 0.0; + // Allow space for labels on the top and port numbers on the left. + double top_pos = -1.0, left_pos = -0.5; if (keep_lower) { top_pos = sp->yAxis->range().lower; left_pos = sp->xAxis2->range().lower; @@ -267,6 +269,14 @@ void SequenceDialog::resetAxes(bool keep_lower) range_ratio = sp->yAxis->axisRect()->height() / (one_em_ * 1.5); sp->yAxis->setRange(top_pos, range_ratio + top_pos); + double rmin = sp->xAxis2->range().size() / 2; + ui->horizontalScrollBar->setRange((rmin - 0.5) * 100, (seq_analysis_.num_nodes - 0.5 - rmin) * 100); + xAxisChanged(sp->xAxis2->range()); + + rmin = (sp->yAxis->range().size() / 2); + ui->verticalScrollBar->setRange((rmin - 1.0) * 100, (num_items_ - 0.5 - rmin) * 100); + yAxisChanged(sp->yAxis->range()); + sp->replot(); } |