Hy,
I have a txt file I'm loading in a qt plain text interface widget (I'm working with python).
I define a "search" function, but I have a problem:
If the word I'm searching is upper than my last search, it find nothing. I have read that I have to put my cursor to the beginning of the text, but impossible to find an example, and all of my test are failure.
Here is my code:
def search_in_txt(self):
txt_to_search = self.lineEdit.text()
try:
result = self.plainTextEdit_2.find(txt_to_search)
if result == False:
# move cursor to the beginning and restart search
self.plainTextEdit_2.textCursor.movePosition(QTextCursor_MoveOperation=Start)
self.plainTextEdit_2.find(txt_to_search)
except:
self.statusbar.showMessage("This is the last iteration founded")
return
Thanx for your help, I'm getting crazy! Is there no option directly in the "find" function to restart from beginning when it arrive at the end of the document?