I have a QDialog and some controls in it. On middle_mouse_button_pressed event I pick widget under cursor and start moving it inside the dialog window. On middle_mouse_button_release set it back in current position.
Actually works fine, but sometimes Qt skips mouse events, randomly. I tried to move items quick and slow, seems like not depend on speed.
Has anybody had similar problem?
I believe QT can lose events if it is already inside another callback. Perhaps it is busy executing mouseMoveEvent while mousePress or mouseRelease happens? I don’t know what self.on_update() does, but perhaps you need to look into using QThread for the update function? I’m guessing here, and I don’t have a lot of experience with QThreads.
self.on_update() isn’t resetting the UI in any way is it?
I see that you’re doing a .raise_() on the widget. Could it be that the mouse up event gets consumed by another widget because the stack order has changed?
EDIT: you’re also calling .update() on the widget. I wasn’t sure if you’d wrapped this with your own code. Hmmm…
I still think your mouse up event might be getting lost because it is busy handling mouse move events.
You might be able to check for mouse release manually in the mouse move event by checking the mouse buttons directly. You might need to enable mouse move events ouside of button presses with SetMouseTracking()
Hi btribble,
just came to say you thanks for tips. I found the problem. It occurred at the time when the mouse was over the control that can receive focus (comboBox in my case) and the event has been redirected to this element. Now i have everything working correctly. Cheers.