diff --git a/src/widget/wglwidgetqopengl.cpp b/src/widget/wglwidgetqopengl.cpp index 25a4a6ef2a8..ee8e93ef2f7 100644 --- a/src/widget/wglwidgetqopengl.cpp +++ b/src/widget/wglwidgetqopengl.cpp @@ -1,3 +1,4 @@ +#include #include #include "widget/openglwindow.h" @@ -54,6 +55,11 @@ void WGLWidget::resizeEvent(QResizeEvent* event) { QWidget::resizeEvent(event); } +void WGLWidget::wheelEvent(QWheelEvent* event) { + QApplication::sendEvent(parentWidget(), event); + event->accept(); +} + bool WGLWidget::isContextValid() const { return m_pOpenGLWindow && m_pOpenGLWindow->context() && m_pOpenGLWindow->context()->isValid(); } diff --git a/src/widget/wglwidgetqopengl.h b/src/widget/wglwidgetqopengl.h index 78b4cd48e82..2dec72c7c50 100644 --- a/src/widget/wglwidgetqopengl.h +++ b/src/widget/wglwidgetqopengl.h @@ -41,6 +41,7 @@ class WGLWidget : public QWidget { protected: void showEvent(QShowEvent* event) override; void resizeEvent(QResizeEvent* event) override; + void wheelEvent(QWheelEvent* event) override; QPaintDevice* paintDevice(); diff --git a/src/widget/wwaveformviewer.cpp b/src/widget/wwaveformviewer.cpp index 93c5f9d6e9e..a9ae7a65baf 100644 --- a/src/widget/wwaveformviewer.cpp +++ b/src/widget/wwaveformviewer.cpp @@ -187,7 +187,7 @@ void WWaveformViewer::wheelEvent(QWheelEvent* event) { if (m_waveformWidget) { if (event->angleDelta().y() > 0) { onZoomChange(m_waveformWidget->getZoomFactor() / 1.05); - } else { + } else if (event->angleDelta().y() < 0) { onZoomChange(m_waveformWidget->getZoomFactor() * 1.05); } }