I have a little problem with QTreeView management of drag&drops :
To illustrate this, I join to this mail the QT-SimpleTreeModel example modified to show that :
Writing in my QAbstractItemModel::flags() :
-------------
if (!index.isValid())
return Qt::ItemIsEnabled;
if (! index.parent().isValid())
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled ;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
---------------
I expected to enable the drops only on non-toplevel items.
But what I got is : enable drops only on CHILDREN of non-toplevel items.
In the example, we can traduce that by :
I can start draging for instance the item "Getting started" but I can't drop it onto "Designing a component/creating a dialog".
However, I can drop it on "Form Editing Mode / Layouts / The grid layout"
I hope I am understandable, please forgive my bad english I'm a french guy :-(
I don't know if it is a bug ? If it is a wanted feature, could you indicate me how can I have the result I expected ?
Bookmarks