roro
22nd June 2007, 08:30
Hi,
This is a mail I sent to QT-support :
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 ?
The support engineer told me that he managed to perform a drop onto for instance "Designing a component/creating a dialog" :confused:, that is forbidden (but I expected that would be allowed) when I execute the example program on my computer (UNIX kubuntu gutsy, QT 4.3.0).
Could you tell me if on other platforms all works perfectly or I someone can reproduce my bug ? or tell me what's wrong in my code or my vision of flags and drags&drops ?
Thanks :)
Romain
This is a mail I sent to QT-support :
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 ?
The support engineer told me that he managed to perform a drop onto for instance "Designing a component/creating a dialog" :confused:, that is forbidden (but I expected that would be allowed) when I execute the example program on my computer (UNIX kubuntu gutsy, QT 4.3.0).
Could you tell me if on other platforms all works perfectly or I someone can reproduce my bug ? or tell me what's wrong in my code or my vision of flags and drags&drops ?
Thanks :)
Romain