[PyQt] how do I reorder items of QListWidget

šãñ niceguysan at gmail.com
Tue Dec 11 17:36:17 GMT 2012


 so far I came up with this script

i am not sure why it is not giving me desired result


**

 *    def changePriority(self,*args):
        crntRow = self.listWidget.currentRow()
        total=self.listWidget.count()

        print "Total no. of items %s, and selected item number is
%s"%(total,crntRow)
        if args[0]=='up':
           if crntRow > 0 :
              crntItem= self.listWidget.takeItem(crntRow)
              self.listWidget.insertItem(crntRow+1,crntItem)
        if args[0]=='down':
           if crntRow + 1  < total:
              crntItem=self.listWidget.takeItem(crntRow)
              sel.listWidget.insertItem(crntRow-1,crntItem)
           else: print "This is the last item cannot move down further."
*
what is wrong , instead of moving up it gets removed...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20121211/9a2856dc/attachment.html>


More information about the PyQt mailing list