[Qt-interest] highlight multiple lines in QTextEdit
Yifei Li
yifli at mtu.edu
Fri Oct 21 04:09:05 CEST 2011
Hi all,
I want to high light all the line 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/qt-interest-old/attachments/20111020/26d0749c/attachment.html
More information about the Qt-interest-old
mailing list