Here's what I'm trying to do: I have certain data that is displayed through a custom widget. There is a lot of such data. At runtime, the user will be presented with a list of all data and they will choose which ones they want to monitor, which will dynamically create the custom widget in a grid. I want to let the users reorganize the widgets in the grid as they please, preferably though drag and dropping.
The closest thing I could find to achieve this is using a QTableWidget with the following properties: setDragEnabled(True), setDragDropOverwriteMode(False), setDragDropMode(QtGui.QAbstractItemView.InternalMove). With these properties, it's possible to drag cells and move them to other cells.
However, this seems to only work with the QTableWidgetItem attached to each cell, not the widgets set though setCellWidget().
Here is a small project illustrating what I'm trying to do: https://gist.github.com/anonymous/02bbcc201316fa8f43e9
You can see that the widgets created (by clicking on the button) are not drag'n'droppable, however if you edit a cell (which sets the QTableWidgetItem), those are drag'n'droppable. It seems the cellWidget part and the item part of a cell are completely independent, and the drag and drop logic only applies to the items, not the cell widgets.
I'm afraid I already know the answer, but... is there any way to do what I want, short of replacing the QTableWidget by a QTableView, using a model, and re-implementing all the drag and drop logic myself?
Or maybe my approach is completely wrong. Maybe there's some other widget or Qt facility that I can use? I'm open to any and all suggestions.
Thanks in advance!