From pykde Tue Aug 29 16:31:30 2006 From: "Oscar Cossu" Date: Tue, 29 Aug 2006 16:31:30 +0000 To: pykde Subject: [PyKDE] [PyQT]problem updating a QTreeView after model changes Message-Id: <45b429340608290931v378f4474h4af1f50af5946da4 () mail ! gmail ! com> X-MARC-Message: https://marc.info/?l=pykde&m=115687040613685 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0537713623==" --===============0537713623== Content-Type: multipart/alternative; boundary="----=_Part_13802_14998507.1156869090101" ------=_Part_13802_14998507.1156869090101 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. ------=_Part_13802_14998507.1156869090101 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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.
------=_Part_13802_14998507.1156869090101-- --===============0537713623== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde --===============0537713623==--