PDA

View Full Version : QtableWidget that don't accept drop item between rows?



sergiomar73
6th September 2008, 04:00
Hi everybody!
I find this forum very helpful, this is my first post.
I'm a newbie using Qt 4.4 and I'm looking for an easy way to drag and drop (move) items internally in a QTableWidget, from its actual position to another free position.
I can move items from one cell to free cells and I can tell my existing items to not accept drops (Qt::ItemIsDropEnabled), that's works ok.
But when I drop an item between rows, the item disappear!
How can I tell the QTableWidget to not accept drops between rows, only onto cells?
Is it possible?
Thanks you very much for your help!
Sergio

vikrams
23rd July 2010, 12:34
I'm a first-time Qt programmer and have a similar issue. I drop entries from a QTreeWidget onto a QTableWidget. But I want to restrict the user to drops 'on cells' only and discard drops between rows. What is the easiest way to do this ?
Any help will be greatly appreciated.

wysota
23rd July 2010, 12:44
Make sure ItemIsDropEnabled flag is not set for an invalid (empty) QModelIndex/root item.

lotek
15th October 2010, 21:55
Hello,
I have an opposite problem, I'd like to INSERT the dragged row of the QTableWidget BETWEEN two other rows. The drag and drop works OK, the insertion is possible only between the rows, but item disappears instead of to be inserted.
Optimally, the gap after the moved item shall be closed ( according part of the rows shall be moved)

any idea how to to do this?

thanks for the help