Strange mouse behavior
I have a class derived from QWidget which has mousePressEvent, mouseMoveEvent, and mouseReleaseEvent overridden. I have two instances of this derived class in my application.
One works exactly how I'd expect, mousePressEvent when the mouse button is pressed, mouseMoveEvent whenever it moves (mouse button down or not), and mouseReleaseEvent when the mouse button is released.
The other doesn't. mousePressEvent fires normally but then mouseMoveEvent won't fire at all. mouseMoveEvent will only start firing once the mouse button is released, which also does not fire a mouseReleaseEvent. At that point, my application thinks it's dragging even though the mouse button isn't being held down. Only with another click will another mousePressEvent and finally a mouseReleaseEvent get triggered.
I have no idea what's causing this, and as far as I know both instances are completely identical so there's no reason it would be happening.
This is Qt 5.10.1 on MSVC 2015. Any help would be greatly appreciated!
my first guess: you didn't call the base class implementation when overriding the mouse event handlers?
Also it would help if you show the code of your mouse event handlers.
Hi, thanks for your response. I managed to solve this after some closer inspection. I wasn't calling the base class implementations, but through a few functions happened to be calling resize and update functions on said QWidget which would eventually loop and cause a stack overflow. After adjusting the offending code, the mouse functions work as expected.