Sweet, the setDown() method was what I needed, thanks!
It's a little disapointing that the right and middle mouse click events
don't seem to work on a mac though.
I guess in that case I will have to make sure that the mousePressEvent
isn't called when the button is dragged. Is there an elegant way to set
some sort of threshold or check if the button was moved a certain
distance between the mouseDown and mouseUp events, and if so, don't
trigger the mousePressEvent? Will have a play, I might have just
answered my own question :-D
Cheers,
frank
On 14/04/12 2:01 AM, Aaron Richiger wrote:
Hello Frank and Sebastian!
You are both right... Because you are discussing about different code,
I guess. The tutorial indicated by Frank does not work on Mac for me
(maybe, I am just to stupid to figure out how to trigger a
RightMouseButtonEvent on Mac, but anyways), so I guess, Sebastian
tried the code of the tutorial on Windows, where right clicks
perfectly work, but they do not leave down the original button.
Then I guess, Frank changed the tutorial code slightly to drag and
drop with left clicks on MacOS. And there it is, the original button
stays down after dragging and I think, this behaviour is platform
independent, so Sebastian would get the same problem I guess...
But it's not a bug of PySide or Qt, but just the normal behaviour of
buttons, if you click them with the left mousebutton. They are looking
"down", to repair this, simply call self.setDown(False) in the
mouseMoveEvent() method. You get a changed version of the tutorial
(not only dragNdrop, but also creating a new widget as Frank wanted) here:
http://pastebin.com/GMbcCWYM
Play around dragging the buttons with the left mouse button and
uncomment the self.setDown() call to see Franks issue platform
independent.
Lot's of "guesses" and "maybes", but could be the solution...
Aaron
I guess this is a bug in PySide, which may depend on OS. I do not
have this behaviour on win xp with newest Pyside and python 26
On 04/13/2012 10:54 AM, Frank Rueter | OHUfx wrote:
Hi everyone,
me again :)
I just implemented the tutorial on this page
<http://zetcode.com/gui/pysidetutorial/dragdrop/> into my code as I
needed to be able to copy QPushButtons from one widget to another
via Drag&Drop. It all works great, accept for the fact that the
original button that I drag becomes checked and stays checked after
I drop it into the other widget.
The example on the above page actually has the same problem accept
it doesn't matter in that example.
The QPushButton is not set to be checkable and I've tried using
setChecked( False ) on the button both in the dragEnterEvent as well
as the dropEvent, but to no avail.
Any ideas how to make the button uncheck itself after it was dropped?
Cheers,
frank
_______________________________________________
PySide mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/pyside
--
Sebastian Elsner - pipeline td - r i s e | fx
t: +49 30 [email protected]
www.risefx.com
r i s e | fx GmbH
Schlesische Strasse 28 Aufgang B, 10997 Berlin
Geschäftsführer: Sven Pannicke, Robert Pinnow
Handelsregister Berlin HRB 106667 B
_______________________________________________
PySide mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/pyside
_______________________________________________
PySide mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/pyside
_______________________________________________
PySide mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/pyside