pyqt4 - pyqt qtextedit move cursor -
i using qtextedit search button. here code.
format = qtextcharformat() format.setbackground(qbrush(qcolor("gray"))) regex = qregexp(pattern) if (self.ui_log.checkbox_case.ischecked()==false): regex.setcasesensitivity(false) pos = 0 index = regex.indexin(self.ui_log.log_textedit.toplaintext(), pos) while (index != -1): cursor.setposition(index) cursor.moveposition(qtextcursor.endofword, 1) cursor.mergecharformat(format) pos = index + regex.matchedlength() self.ui_log.log_textedit.movecursor(??????) index = regex.indexin(self.ui_log.log_textedit.toplaintext(), pos)
qtextedit have scrollbar input file providing in qtextedit large..
the searched text high lighted, how can move searched text providing index of word ?
instead of moving existing cursor, set new one:
self.ui_log.log_textedit.settextcursor(cursor);
Comments
Post a Comment