0
我正在使用Qtextedit与搜索按钮。这里是代码。pyqt qtextedit移动光标
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有一个滚动条作为输入文件我在的QTextEdit提供大..
搜索到的文字是高点燃,我怎么能移动通过提供词的索引和搜索文本?
非常感谢......它的作品..... –