[Interest] Cannot enable dragging from QAbstractItemModel

Alex Malyushytskyy alexmalvtk at gmail.com
Wed Oct 2 01:03:41 CEST 2013


Did you try to set setDragDropMode of the tree view to
QAbstractItemView::DragDrop?
QAbstractItemView::InternalMove accepts only move operation from itself and
does not accept copy.

Regards,
     Alex


On Tue, Oct 1, 2013 at 3:33 PM, Etienne Sandré-Chardonnal <
etienne.sandre at m4x.org> wrote:

> Dear all,
>
> After successfully enabling drag from a QAbstractListModel, I am trying to
> do the same with a tree model.
>
> Here is what I did:
>
> //In constructor:
> setSupportedDragActions(Qt::CopyAction);
>
>
> //Qt::ItemFlags Model::flags(const QModelIndex & index) implementation
> return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
>
> I also implemented mimeData() , but it gets never called anyway.
>
> Dragging is not triggered, and items are only selected.
>
> I do not know what to do for enabling drag support? It works well with
> QAbstractListModel
>
> Thanks,
>
> Etienne
>
>
>
>
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131001/309d05a2/attachment.html>


More information about the Interest mailing list