[Qt-jambi-interest] Help with Drag and Drop in QTreeView
Curt Nowak
cnowak at bwl.uni-hildesheim.de
Thu Aug 28 09:45:09 CEST 2008
Hi,
although I have not worked with drag and drop yet, to me it seems you might want to read (even further) through http://doc.trolltech.com/qtjambi-4.4/html/index.html <http://doc.trolltech.com/qtjambi-4.4/html/index.html> . I think you will have to subclass QTreeModel in order to make things work. Overwrite at least "public boolean dropMimeData(QMimeData data, Qt.DropAction action, int row, int column, QModelIndex parent)" if your model only contains Strings. If you are working with more complex data types you will need to look further into the whole MIME type business :-)
Hope that helps, Curt
________________________________
Von: qt-jambi-interest-bounces at trolltech.com im Auftrag von ??
Gesendet: Mi 27.08.2008 17:37
An: qt-jambi-interest at trolltech.com
Betreff: [Qt-jambi-interest] Help with Drag and Drop in QTreeView
I have set the QTreeView as follows:
ui.treeView.setDragEnabled(true);
ui.treeView.viewport().setAcceptDrops(true);
ui.treeView.setDropIndicatorShown(true);
ui.treeView.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove);
Then what else need to be done with the QTreeModel, which is used as the tree model???
Can you tell me some details? An example will be better. I just want to implement the item's moving from one parent item to another item.
Thanks.
More information about the Qt-jambi-interest
mailing list