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?
OutOfReach
0
Newbie Poster
Recommended Answers
Jump to PostA 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)
Jump to PostIn 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): …
All 5 Replies
woooee
814
Nearly a Posting Maven
OutOfReach
0
Newbie Poster
OutOfReach
0
Newbie Poster
woooee
814
Nearly a Posting Maven
OutOfReach
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.