[Interest] How to correctly use “application/x-qabstractitemmodeldatalist” mime type in derived model/view clas

frares at gmail.com frares at gmail.com
Wed Jul 11 18:26:16 CEST 2012


Hi, all,

I'm building an application using QAbstractItemModel for custom types of  
items in a QListView and in a QTreeView. Those items have to be  
dragged/dropped inside the QTreeView – both copy and move – and dragged  
from the QListView and dropped to the QTreeView.

Although much of the functionality is already working, on the tree model  
class, in the “dropMimeData” method, I don't get the “row” and “column” the  
data was dropped to, they always come as -1. Also, the “parent” comes as  
the header item.

I know the problem is that I have derived QAbstractItemModel for a model  
view of a QTreeView and also derived the QTreeView, adding my own mouse  
event handlers to generate a QDrag object, carrying the needed information  
to move/create new items in the QTreeView, and it only started to work when  
I switched to “application/x-qabstractitemmodeldatalist” mime type,  
encoding and decoding my data to it.

Although many sample code found here and there suggests that this mime type  
would also carry a location, I also could not manage to recover it, as far  
as I did not encoded it at first, but I don't think this is what I am  
looking for.

Thanks
Francisco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120711/50d47c91/attachment.html>


More information about the Interest mailing list