Blank Hi all,

I am trying to implement a Drag&Drop functionnality in my tree.
I want to be able to move the leaves and drop them either between other
leaves or directly on a node.

I started to code this (cf attachement).
The D&D functionnality is mainly OK thanks to Eskil !! (
http://lists.trolltech.com/pipermail/qt-jambi-interest/2009-July/001305.html )
but there remains a problem.

My understanding
------------------
When using D&D, the view automatically call these methods in the model:
- insertRows() -> I insert a leaf with text "Foo" at the dropped emplacement
 - setData() -> I set the underlying model string from "Foo" to the rgiht
string value at the dropped emplacement
 - removeRows() -> I remove the dragged string

My problem
-----------------
The only problem remaining concerns the method setData().
As you can see from the prompt, the underlying model is updated correctly.
However, the method data keeps returning string "Foo" for inserted index. I
found that was because of indexToValue() method that keeps returning "Foo"
despites the underlying model has been updated in the setData() method().
I don't understand why because I explicitly emit the dataChanged signal on
this index (line 107) after updating underlying data.

Question
-------------
What did I missed ?
Should I call something specific in the setData() method to bind the
inserted index to the underlying value ?


Thanks in advance.
Julien.

Attachment: DraggableTreeModel.java
Description: Binary data

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to