I'm trying to make a searchable combo box. Right now it searches it, but will only give me 1 result and I have to type in the whole item in the list for it to edit the list to only include the resulted item. I'm trying to get it where if I have multiple results in the editable but not insertable combo box, that it will give me every result in the combo box, even if I only type in a partial match. For example if I type in "200" it will give me all the items that contain anywhere in it "200" and then afterwards if I type in "100" it will give me a whole different list of items to choose from but the list now contains "100" anywhere in the items instead of the previous "200".
Sample of my list
self.Part = ["200019359", "300000272", "300000275", "200018792", "10024769", "10015919", "102000765"]
My function
def PartNumber(self):
if self.PartNum.currentText() != "" :
results = [s for s in self.Part if self.PartNum.currentText() in s]
self.PartNum.clear()
self.PartNum.addItems(results)
else:
self.PartNum.clear()
self.PartNum.addItems(self.Part)
Connecting it to the combo box
self.PartNum.activated.connect(self.PartNumber)