How to capture mouse move event?

I am struggling with capturing mouse move event.
e.g. I have this custom style and set it to the interactor.

namespace {

  class vtkMouseMoveStyle : public vtkInteractorStyleTrackballCamera
    static vtkMouseMoveStyle* New();
    vtkTypeMacro(vtkMouseMoveStyle, vtkInteractorStyleTrackballCamera);

    virtual void OnLeftButtonUp() override
      // Forward events


    virtual void OnMouseMove() override
        std::cout << "Mouse moved!";


} // namespace

But the OnMouseMove() method here only fires when I am holding left/right button and moving my mouse.
I would like to capture the event as soon as the cursor location changes inside the viewport. Can anyone point me to the right direction?


Are you using Qt by any chance? In Qt, you have to enable mouse tracking in order to get mouse move events also when no button is pressed.