[PyQt] mouseMoveEvent - Delay after mouse move.
amicitas at gmail.com
Sat Oct 11 10:59:58 BST 2008
I have A QTreeView and I have run into a problem in which when I move the
mouse too quickly after selecting and item, instead of dragging the item the
widget goes into selection mode. This only happened inconsistently (though
quite often) and it took a while for me to track down what is happening.
What I think is happening is that there is a small delay after I move the
mouse before mouseMoveEvent gets called. If I move the mouse too fast,
especially if started near the edge of the item, then by the time
mouseMoveEvent gets called the mouse is no longer over a selected item and
selection mode is started (it took some digging in the source for
mouseMoveEvent to figure out what was going on).
This is not a simple issue of distance since as long as I move the mouse
slowly this doen't happen, even if I start near the edge of the item. The
delay time is hard to measure, but it looks as though the time between mouse
move events is about 50ms.
This causes especially wierd behavior since the items, being text, are
smaller vertically than horizontally, so selection mode only gets triggered
if I move the mouse vertically.
I think I can solve this by reimplementing mousePressEvent & mouseMoveEvent
so that when a move is detected it uses the position of the press, rather
that the current mouse position, to check whether the item is selected.
However before I do this I wanted to see if anyone has run accross this
before and if any knows how to solve it. Is there a way to reduce the time
before the mouse move event? If there is is that a good idea to do? Is
there any better way to deal with this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt