[PySide] uncheck button after drag&drop

Frank Rueter | OHUfx frank at ohufx.com
Mon Apr 16 07:43:24 CEST 2012


yeah, I just liked the name "sloppy click" :)
totally agree though, and I guess that's why I was asking for help.
I initially tried to read out how far the mouse is moving inside of the 
mouseMoveEvent but couldn't get it right.
I used:
setMouseTracking( True )
curPos = event.pos()

but curPos is not evaluated until after the mouse button is released the 
first time. That's why I implemented the drag event to access the 
coordinates through that. But, of course as you pointed out, I want to 
avoid the drag event until the mouse has moved a certain distance.

Do you have an example of how to read the cursor position in the 
mouseMoveEvent?

Cheers,
frank


On 4/16/12 3:57 PM, Bradley Smith wrote:
>
>     in case somebody is interested:
>     I've managed to implement "sloppy clicks", i.e. clicks during
>     which the mouse pointer moves a little bit (happens a lot when
>     using a wacom pen). This was a problem because the buttons need to
>     be "dragable", and the moment the mouseMoveEvent started, the
>     mouseReleaseEvent never got called. So even a 1 pixel shift which
>     feels like a click to the user wouldn't result in the expected
>     behaviour.
>
>
> I don't think of it as sloppy clicks, but as not enough movement to 
> start a drag. In the mouseMoveEvent handler, I would check that the 
> manhattan distance over the 5 pixels and only then start the drag. I 
> would also remove the check of the manhattan distance in the dropEvent 
> handler. Even if the item is dragged away and then dropped exactly 
> back at the start position, the operation should be seen as a 
> drag/drop not a click. A click will occur only if the mouse is pressed 
> and then released without ever moving more than 5 pixels from the 
> press position.
>
>   Bradley
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20120416/572ed0d8/attachment.html>


More information about the PySide mailing list