How to use QTreeWidget FindItem in PyQt?

1

I have a QTreeWidget tree with several items previously included. I need to look up if a string x has the same text value as my QTreeWidgetItem , so I need to check all the items in my tree. Does anyone know how I can use this method?

Or how can I get my QTreeWidget to become a list?

    
asked by anonymous 21.02.2014 / 18:36

1 answer

1

Try findItems , QTreeWidget method:

tree = QtGui.QTreeWidget()
#...
items = tree.findItems("Teste", QtCore.Qt.MatchRecursive, 0)

This produces a list with all items ( QTreeWidgetItem ) whose text matches the search parameter. There are more search options, take a look at the documentation method, especially at MatchFlag .

    
21.02.2014 / 20:44