PyQt: QListviewItemIterator

Tina I tinaweb at bestemselv.com
Wed Jan 17 00:48:52 EST 2007


David Boddie wrote:
> 
> When it.current() returns None. You can rewrite what you already
> have like this:
> 
>  it = QListViewItemIterator(self.authListView)
>  while it.current():
>      item = it.current()
>      if item.text(0).contains(filterString) or \
>         item.text(1).contains(filterString) or \
>         item.text(2).contains(filterString):
> 
>          item.setVisible(1)
>      else:
>          item.setVisible(0)
>      it += 1
> 
> If you don't like calling item.current() twice for some reason,
> you could write this:
> 
>  it = QListViewItemIterator(self.authListView)
>  item = it.current()
>  while item:
>      if item.text(0).contains(filterString) or \
>         item.text(1).contains(filterString) or \
>         item.text(2).contains(filterString):
> 
>          item.setVisible(1)
>      else:
>          item.setVisible(0)
>      it += 1
>      item = it.current()
> 
> David

Ah, of course!
Thanks!!

Tina



More information about the Python-list mailing list