Moving Python objects around a QAbstractItemModel and QTreeView drag/drop

Kyle Altendorf sda at fstab.net
Mon Sep 28 03:32:33 BST 2020


On 2020-09-27 22:06, Scott Ballard wrote:
> Have there been any advances made in drag/drop Python objects contained 
> in a QAbstractItemModel and QTreeView? Years ago you'd have to pickle 
> the Python object into a QMimeData and after the move decode it. This 
> seems a bit crazy just to move an item in a TreeView.

Toss it in a dict and pass the key through the drag process.  My objects 
happen to have UUIDs for other uses so I use that.

Cheers,
-kyle


More information about the PyQt mailing list