title: Drag and dropping Qt widgets in a grid at runtime
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>However, this seems to only work with the QTableWidgetItem attached to each cell, not the widgets set though setCellWidget().</p>
  
  <p>Here is a small project illustrating what I'm trying to do: <a href="https://gist.github.com/anonymous/02bbcc201316fa8f43e9" rel="nofollow">https://gist.github.com/anonymous/02bbcc201316fa8f43e9</a></p>
  
  <p>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.</p>
  
  <p>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?</p>
  
  <p>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.</p>
  
  <p>Thanks in advance!</p>