I have the following class :
class Curve2DOpenGLWidget : public QOpenGLWidget, protected QOpenGLFunctions_3_3_Core {
Q_OBJECT
public:
Curve2DOpenGLWidget( QWidget* parent = nullptr );
~Curve2DOpenGLWidget();
void initializeGL() override;
void resizeGL(int width, int height) override;
void paintGL() override;
void NativePaintGL();
protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
};
I want to use wheelEvent to zoom in / zoom out in my scene.
Here is the code :
void Curve2DOpenGLWidget::wheelEvent( QWheelEvent* event ) {
QOpenGLWidget::wheelEvent(event);
float numStep = (event->angleDelta().y() / 8) / 15;
m_camera.MoveFront(numStep * 0.1f);
}
It does what I want, but this event is not called when I move the mouse and use mouse wheel at the same time.
This code works on all the other widgets I've implemented (QGraphicsView, etc.). I'm wondering if there is anything special to do on QOpenGLWidget ?
I can't explain this behaviour... If it can help, I'm working on Ubuntu 14.04 LTS