Skip to content

Commit

Permalink
PlotView: use QWheelEvent::position when available
Browse files Browse the repository at this point in the history
This fixes a warning about using the deprecated `pos` method
  • Loading branch information
miek committed Oct 16, 2023
1 parent c2566d2 commit 88549e8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/plotview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "plotview.h"
#include <iostream>
#include <fstream>
#include <QtGlobal>
#include <QApplication>
#include <QClipboard>
#include <QDebug>
Expand Down Expand Up @@ -231,7 +232,11 @@ bool PlotView::viewportEvent(QEvent *event) {

// `updateViewRange()` keeps the center sample in the same place after zoom. Apply
// a scroll adjustment to keep the sample under the mouse cursor in the same place instead.
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
zoomPos = wheelEvent->position().x();
#else
zoomPos = wheelEvent->pos().x();
#endif
zoomSample = columnToSample(horizontalScrollBar()->value() + zoomPos);
if (scrollZoomStepsAccumulated >= 120) {
scrollZoomStepsAccumulated -= 120;
Expand Down

0 comments on commit 88549e8

Please sign in to comment.