[PyKDE] [PyQt]: how to refresh a QTreeView widget?

Andreas Pakulat apaku at gmx.de
Fri Sep 8 15:00:26 BST 2006


On 08.09.06 15:23:50, Oscar Cossu wrote:
>    def removeRows(self,arow,count,parent):
> 
>          self.beginRemoveRows(parent,arow,arow+count-1)
> 
>                for ii in range(count):
>                     ##code for removing a row from QDomDocument here
> 
>          self.endRemoveRows()
>          return True
>
> This is my model class. When i remove a row the qtreeview repaint the tree
> but the row deleted isn't the one i've selected.
> example:
> 
> document
>     element1
>     element2
>     element3
> 
> pick  elements2 for removing.
> treeview update after removing but show:
> 
> document
>    element1
>    element2
> 
> Now, if i do:
> print  qtreeview.model().domDocument.toString()
> the result is:
> 
> document
>     element1
>     element3

Your removeRows looks ok. I guess you're either telling the treeview (by
false row number) that it should remove the last row, or your data
method doesn't fetch the proper row from the document.

As you use QDomDocument, your complete model is probably not that large,
can you post a complete example, or at least the complete model
including QDomItem.

Andreas

-- 
You'll feel devilish tonight.  Toss dynamite caps under a flamenco dancer's
heel.




More information about the PyQt mailing list