PDA

View Full Version : Drag and drop reordering in a QTableWidget



Lendrick
21st November 2009, 18:54
Greets!

So I have this QTableWidget, which I'm trying to keep in sync with an ordered list of objects. I've allowed internal drag and drop reordering, which seems to work okay in the table itself, but when the drag occurs, I need some way to figure out what row was moved, and where it was moved *to*. How can I do this?

Bart

tanderson
23rd November 2009, 00:19
override mousePressEvent and store the item. override dropEvent and in there you can get the item that received the drop. You might want to look into view/model classes. There is a learning curve, but it is more than worth it.