diff options
author | Jirka Novak <j.novak@netsystem.cz> | 2021-01-02 13:45:43 +0100 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2021-01-02 14:30:57 +0000 |
commit | f0c703e22d5c6096dd945b4f9fbc93a67c4c261e (patch) | |
tree | 9784a61a4ffa26a5651c3ccb04fbdae892f01714 /ui/qt/rtp_player_dialog.cpp | |
parent | 962ff4883f2e5be8a9095095a782d966f85c0ecf (diff) |
RTP Player: x axis centering correction
When waveform start much later than at time 0s, centering of waveform
was incorrect. The reason was that range was taken before rescalingAxes.
Patch solves the issue.
Diffstat (limited to 'ui/qt/rtp_player_dialog.cpp')
-rw-r--r-- | ui/qt/rtp_player_dialog.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/ui/qt/rtp_player_dialog.cpp b/ui/qt/rtp_player_dialog.cpp index 8118dd8286..4d6f2c65c1 100644 --- a/ui/qt/rtp_player_dialog.cpp +++ b/ui/qt/rtp_player_dialog.cpp @@ -663,14 +663,13 @@ void RtpPlayerDialog::updateHintLabel() void RtpPlayerDialog::resetXAxis() { QCustomPlot *ap = ui->audioPlot; - QCPRange x_range = ap->xAxis->range(); double pixel_pad = 10.0; // per side ap->rescaleAxes(true); double axis_pixels = ap->xAxis->axisRect()->width(); - ap->xAxis->scaleRange((axis_pixels + (pixel_pad * 2)) / axis_pixels, x_range.center()); + ap->xAxis->scaleRange((axis_pixels + (pixel_pad * 2)) / axis_pixels, ap->xAxis->range().center()); axis_pixels = ap->yAxis->axisRect()->height(); ap->yAxis->scaleRange((axis_pixels + (pixel_pad * 2)) / axis_pixels, ap->yAxis->range().center()); |