[PyKDE] [PyQT]problem updating a QTreeView after model changes
Oscar Cossu
zerozerosette at gmail.com
Tue Aug 29 17:31:30 BST 2006
Hy all.
I use a QTreeView to show a QDomDocument object. Using drag & drop i makes
change to the DOM three.
The issue: when i send the signal to view to update, data goes corrupted,
but only in the view.
This is the code:
def dropEvent(self, event):
oggetto=event.source()
parent=oggetto.indexAt(event.pos()).parent() ## this manage the
ModelIndex of target when drop
NomeDest=parent.child(oggetto.indexAt(event.pos
()).row(),0).data().toString()
DestId=self.getValoreCaratteristica(parent.child(oggetto.indexAt(
event.pos()).row(),1).data().toString(),"id") ## a function that parse the
node to find the specified Attributes (in this case "id")
DragTargetElem=self.findNodeByTagNameID(NomeDest,DestId) ## this
return the QDomNode specified by his name and his id
targetParent=DragTargetElem.parentNode()
targetParent.insertBefore(self.view.startDragModelInd,
DragTargetElem) ##change the Dom layout
oggetto.model().emit(QtCore.SIGNAL("layoutChanged()")) ## HERE,
work but treeview display garbage text
print DragTargetElem.ownerDocument().toString() ## used to
verify the Dom consistence
What error? treeview display a Dom without the dragged/dropped node, also
the other node is doubled.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20060829/182d007c/attachment.html
More information about the PyQt
mailing list