下面的代码创建了一个,用 25 行文本填充它,并使用除了查找文本之外还选择它的方法QTextBrowser
找到一行 'Line of text # 0011' 。view.find
如何取消选择.find
方法选择的文本?
from PyQt4 import QtCore, QtGui
app = QtGui.QApplication([])
view = QtGui.QTextBrowser()
for i in range(25):
view.append('Line of text # %004d'%i )
view.moveCursor(QtGui.QTextCursor.End)
view.find('Line of text # 0011', QtGui.QTextDocument.FindBackward)
view.show()
app.exec_()