Ok I'll get straight to the point, how can a create a search box? You know, you type something in and it filters out the ones that don't match. Is there a special widget for this? Or would I have to create a normal lineedit widget and do all the filtering manually?

A Google codesearch came up with only the do it yourself, the gist of which used textChanged. This snippet was in one of the hits

searchLabel = QtGui.QLabel(" Search", self)
        hLayout.addWidget(searchLabel)
        self.searchText = QtGui.QLineEdit()
        searchLabel.setBuddy(self.searchText)
        hLayout.addWidget(self.searchText)

        self.treeWidget = self.createTreeWidget()
        vLayout.addWidget(self.treeWidget)

        self.connect(self.searchText,
                     QtCore.SIGNAL('textChanged(QString)'),
                     self.treeWidget.searchItemName)

Hmm well it turned out a little harder than I was expecting, I am using a QListWidget, I am trying to search for items in the list, but I have a problem, I plan on clearing the list and showing the ones that match, but If i clear the list I'll delete the existing entries, should I put them in a list, dictionary, etc...?

In pseudo-code it would be something like this assuming a class format (ignoring case for now)

def __init__(self):
          self.orig_list=[ "Original", "words", "you", "want", "to", "test"]
          self.new_list = orig_list[:]  ## first pass - to be used by test_list

     def compare_when_text_changed():
          test_list=self.new_list[:]
          self.new_list=[]
          for word in test_list:
             if word.startswith(self.entered_in_qt_edit_box):
                  self.new_list.append(word)

          ## self.new_list now contains the words that match so far
          ## update list box from self.new_list

     ## not necessary to return anything since self. is used.

I thought that someone would have posted code to do this, but coding this could become so funky that no one wants to put it out there on the internet I guess.

Ahh! Man your a lifesaver! You just saved me from hours and hours of frustration! I cannot thank you enough!! :)

This question has already been answered. Start a new discussion instead.