[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] how do I reorder items of QListWidget
From:       šãñ <niceguysan () gmail ! com>
Date:       2012-12-11 17:48:17
Message-ID: CAAEA0x89g0DjyvJg3ucyY5a4A3LbJ-uzUquGKKKw4JE6uUoeug () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


 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...

[Attachment #5 (text/html)]

	  so far I came up with this script<br><br>i am not sure why it is not giving me \
desired result<br><br><br><b></b>  <p></p>

    
    <form action="http://fb/a/headlineanimator/install" method="get" \
accept-charset="utf-8" target="_blank" onsubmit="return window.confirm(&quot;You are \
submitting information to an external page.\nAre you sure?&quot;);">


      <p style="background-image:url(&quot;/fb/lib/images/icons/chameleon_red/add.gif&quot;)">
  <b>       def changePriority(self,*args):<br>               crntRow = \
self.listWidget.currentRow()<br>               total=self.listWidget.count()<br><br>  \
print &quot;Total no. of items %s, and selected item number is \
%s&quot;%(total,crntRow)<br>

               if args[0]==&#39;up&#39;:<br>                     if crntRow &gt; 0 \
:<br>                           crntItem= self.listWidget.takeItem(crntRow)<br>       \
self.listWidget.insertItem(crntRow+1,crntItem)<br>               if \
args[0]==&#39;down&#39;:<br>

                     if crntRow + 1   &lt; total:<br>                           \
crntItem=self.listWidget.takeItem(crntRow)<br>                           \
sel.listWidget.insertItem(crntRow-1,crntItem)<br>                     else: print \
&quot;This is the last item cannot move down further.&quot;<br>

</b></p></form>what is wrong , instead of moving up it gets removed...<br>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic