I am trying to highlight the item in my list upon the input of the text in the LineEdit but however, not only am I unable to get it to work but it also does not highlights the item in the List. Am I writing it wrong somewhere? Any advices?
list01 = ['Apple','Pear','Orange','Grape','Lychee']
self.fruitsList.addItems(list01)
fruitTxt = str(textInput)
self.connect(self.textInput,('returnPressed()'), self.updateSelect)
def updateSelect(self):
self.fruitsList.findItems(str(fruitTxt), flags = Qt.MatchExactly)
self.fruitsList.setCurrentIndex(0)
fruitsList = QListWidget()
list01 = ['Apple','Pear','Orange','Grape','Lychee']
self.fruitsList.addItems(list01)
textInput = QLineEdit()
fruitTxt = str(textInput)
self.connect(self.textInput,('returnPressed()'), self.updateSelect)
def updateSelect(self):
self.fruitsList.findItems(str(fruitTxt), flags = Qt.MatchExactly)
self.fruitsList.setCurrentIndex(0)
To copy to clipboard, switch view to plain text mode
Bookmarks