aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorMartin Mathieson <martin.r.mathieson@googlemail.com>2018-02-08 09:51:13 +0000
committerAnders Broman <a.broman58@gmail.com>2018-02-09 05:30:55 +0000
commitbd41b8e417e2f769ca318388a8cdccb1a5064bae (patch)
treef8c699f17fb10b3db8d5b8a99bf50c3b2afff16d /ui
parentb5113126338b7d16b08a5b0a482b07e856818f33 (diff)
RLC graph: fix zooming, both in normal case and when graph direction has been switched
Change-Id: I05e02b2821367ef1a78b9ededd462324053cf06e Reviewed-on: https://code.wireshark.org/review/25683 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/lte_rlc_graph_dialog.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/ui/qt/lte_rlc_graph_dialog.cpp b/ui/qt/lte_rlc_graph_dialog.cpp
index 9020dd9982..931c36a6d2 100644
--- a/ui/qt/lte_rlc_graph_dialog.cpp
+++ b/ui/qt/lte_rlc_graph_dialog.cpp
@@ -169,9 +169,13 @@ void LteRlcGraphDialog::completeGraph(bool may_be_empty)
QPushButton *save_bt = ui->buttonBox->button(QDialogButtonBox::Save);
save_bt->setText(tr("Save As" UTF8_HORIZONTAL_ELLIPSIS));
- connect(rp, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(graphClicked(QMouseEvent*)));
- connect(rp, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(mouseMoved(QMouseEvent*)));
- connect(rp, SIGNAL(mouseRelease(QMouseEvent*)), this, SLOT(mouseReleased(QMouseEvent*)));
+ // Don't want to connect again after first time. - causes mouse handlers to get called
+ // multiple times.
+ if (!may_be_empty) {
+ connect(rp, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(graphClicked(QMouseEvent*)));
+ connect(rp, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(mouseMoved(QMouseEvent*)));
+ connect(rp, SIGNAL(mouseRelease(QMouseEvent*)), this, SLOT(mouseReleased(QMouseEvent*)));
+ }
disconnect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
this->setResult(QDialog::Accepted);
@@ -645,8 +649,9 @@ void LteRlcGraphDialog::mouseReleased(QMouseEvent *event)
if (rubber_band_) {
rubber_band_->hide();
if (!mouse_drags_) {
- resetAxes();
+ // N.B. work out range to zoom to *before* resetting axes.
QRectF zoom_ranges = getZoomRanges(QRect(rb_origin_, event->pos()));
+ resetAxes();
if (zoom_ranges.width() > 0.0 && zoom_ranges.height() > 0.0) {
rp->xAxis->setRangeLower(zoom_ranges.x());
rp->xAxis->setRangeUpper(zoom_ranges.x() + zoom_ranges.width());