PDA

View Full Version : Dragging an item from QTableView to a QPushButton



steg90
23rd May 2007, 10:42
Hi,

I have a push button which is used as a 'trash can'. I want to be able to drag items to it from my QTableView which would then delete the item. Is this possible?

Regards,
Steve

wysota
23rd May 2007, 11:51
Yes. Reimplement dragEnterEvent and dropEvent for the button. Just make sure you only accept move actions (or delete the item in the dropEvent).

steg90
23rd May 2007, 11:57
Hi,

Thought as much, guess I just subclass a QPushButton.

Regards,
Steve