[PySide] uncheck button after drag&drop
a.richi at bluewin.ch
Fri Apr 13 16:01:02 CEST 2012
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:
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...
> 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?
>> PySide mailing list
>> PySide at qt-project.org
> Sebastian Elsner - pipeline td - r i s e | fx
> t: +49 30 20180300sebastian at 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
> PySide at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PySide