[PyQt] stopping tool button from staying depressed in D

danny shevitz at lanl.gov
Tue Sep 21 17:30:33 BST 2010


Howdy,

I'm in progress dragging icons off a toolbar. I currently create QToolButtons
and use addWidget to add them to the toolbar. I am starting the drag by
connecting to the pressed even of the QToolButton, e.g.

button.pressed.connect(self.startDrag)

Life is good. I have a small visual artifact that the button now stays
pressed for all eternity. The best I have been able to do is to modify startDrag

def startDrag(self):
  button.setDown(False)
  ...

I have also tried starting the drag by overloading mouseMoveEvent. The button
still stays pressed, and I need to do a self.setDown(False).

Is there a cleverer way to do this so that the button ignores the pressed status
after the drag starts?

thanks,
Danny





More information about the PyQt mailing list