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>
This commit is contained in:
Martin Mathieson 2018-02-08 09:51:13 +00:00 committed by Anders Broman
parent b511312633
commit bd41b8e417
1 changed files with 9 additions and 4 deletions

View File

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