【发布时间】:2013-08-26 21:24:46
【问题描述】:
我正在使用带有搜索按钮的 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 中提供的输入文件很大..
搜索的文本被高亮显示,我如何通过提供单词索引来移动到搜索的文本?
【问题讨论】: