[Interest] highlight multiple lines in QTextEdit
Yifei Li
yifli82 at gmail.com
Fri Oct 21 15:53:20 CEST 2011
Hi
I asked this question yesterday on the old mailing list and saw an email
today the old mailing list has been shutdown, so I repost my question here.
I want to high light all the lines in between start and end, I tried
something as follows:
extras = []
cursor.movePosition(QTextCursor.StartOfLine)
self.setTextCursor(cursor)
highlight.cursor = self.textCursor()
extras.append(highlight)
start = self.start + 1
while start < self.end:
cursor.movePosition(QTextCursor.Down)
highlight.cursor = self.textCursor()
extras.append(highlight)
start = start + 1
self.setExtraSelections(extras)
However, only the last line is highlighted. Can someone help me fix my
problem?
Thanks
Yifei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20111021/b07775b6/attachment.html>
More information about the Interest
mailing list