[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyKDE] [PyQT]problem updating a QTreeView after model changes
From: "Oscar Cossu" <zerozerosette () gmail ! com>
Date: 2006-08-29 16:31:30
Message-ID: 45b429340608290931v378f4474h4af1f50af5946da4 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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.
[Attachment #5 (text/html)]
Hy all.<br>I use a QTreeView to show a QDomDocument object. Using drag & drop i \
makes change to the DOM three.<br><br>The issue: when i send the signal to view to \
update, data goes corrupted, but only in the view. <br> <br>This is the \
code:<br><br>def dropEvent(self, \
event):<br> \
oggetto=event.source()<br> \
parent=oggetto.indexAt(event.pos()).parent() ## this manage the ModelIndex of \
target when drop<br><br> NomeDest= \
parent.child(oggetto.indexAt(event.pos()).row(),0).data().toString()<br> \
DestId=self.getValoreCaratteristica(parent.child(oggetto.indexAt(event.pos()).row(),1).data().toString(),"id") \
## a function that parse the node to find the <span \
onclick="dr4sdgryt(event)">specified Attributes (in this case \
"id")</span><br><br> \
DragTargetElem=self.findNodeByTagNameID(NomeDest,DestId) ## this return the QDomNode \
specified by his name and his id <br> \
targetParent=DragTargetElem.parentNode()<br> \
targetParent.insertBefore(self.view.startDragModelInd, DragTargetElem) ##change the \
Dom layout<br><br> \
oggetto.model().emit(QtCore.SIGNAL("layoutChanged()")) ## HERE, work \
but treeview <span onclick="dr4sdgryt(event)">display garbage text</span><br> \
<br> print \
DragTargetElem.ownerDocument().toString() ## used to \
verify the Dom <span onclick="dr4sdgryt(event)">consistence<br><br><br><br>What \
error? treeview </span><span onclick="dr4sdgryt(event)">display</span><span \
onclick="dr4sdgryt(event)"> a Dom without the dragged/dropped node, also the \
other node is doubled.<br></span>
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic