Searching a PyQT List View?

Wayne Pierce wayne at mishre.com
Fri Jan 3 06:12:26 CET 2003


I have an array of arrays, containing information I would like to put
in to a List View.  The problem I seem to have, is that I cannot
figure out how to determine if part of the data already exists in the
list view.

Each line of the array is in the following format:

 [src,dst,proto,port,alert]

All of the items are strings, except for 'port'.  I can add the items
using:

  QListViewItem(self.lstvwRules, i.src, i.dst, i.proto, str(i.port),
i.action)

This adds each item fine, however it is all one line which cannot be
collapsed; so I have to add each item as a child QListViewItem. 
Something like this:

  src = QListViewItem(self.lstvwRules, i.src)
  dst = QListViewItem(src, i.dst)
  proto = QListViewItem(dst, i.proto)
  port = QListViewItem(proto, i.port)
  alert = QListViewItem(port, i.alert)

(I have not actually tested the above, but it seems logical)

The question I have is how to find the value of a column after the
QListViewItem has already been added.  For example, is there a way to
get the first item of the first column, then if it matches the data I
want to enter check the second item, etc.?

Thanks for any pointers,

W-




More information about the Python-list mailing list