I have this TableView, which is sorted by column when the user clicks
on the header. The problem is though, that all the items are selected
and nothing gets sorted. But if the window loses focus everything's
get's sorted.

Basically I have list of tags say,
[{"artist":"Artist1","title":Title1"} , {"artist":"Artist2" , "title":
"Title2"}] etc. Where each tag is listed in a column. Then I sort them
and reset. Here's the code:

    def sort(self,column,order=Qt.DescendingOrder):
        tag=self.headerdata.text
        newdic={}
        li=[]
        i=0
        for z in self.taginfo: #taginfo has all the tags
            if not newdic.has_key(z[tag]):
                newdic[z[tag]]=z
                li.append(z[tag])
            else:
                newdic[z[tag] + str(i)]=z
                li.append(z[tag] + str(i))
                i+=1
        li.sort()
        self.taginfo=[newdic[z] for z in li]
        self.reset()

Any ideas?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to