[PySide] uncheck button after drag&drop

Bradley Smith bradley at baysmith.com
Mon Apr 16 05:57:35 CEST 2012

> 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20120415/16a86b5c/attachment.html>

More information about the PySide mailing list