Hi!
In the attached example the first line should be highlighted.
Unfortunately it does not work on my system[1]
Normally I would think I have done something wrong but this code works
on my laptop[2]
I haven't seen anything relevant in the changelogs. Did I miss anything?
Regards
Henning
[1] Ubuntu Jaunty, PyQt 4.4.4, sip 4.7.9, Qt 4.5 (but I think it
already failed with the previous Qt version)
[2] Ubuntu Hardy, PyQt 4.3.3, sip 4.7.7, Qt 4.4.3
PS: Anyone having problems with QSyntaxHighlighter and Qt 4.5 should
read http://labs.trolltech.com/blogs/2008/11/04/910/
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
def main():
app = QApplication(sys.argv)
edit = QPlainTextEdit()
edit.setPlainText(open("test.py").read())
edit.resize(640,480)
ex = QTextEdit.ExtraSelection()
ex.cursor = edit.textCursor()
ex.format.setProperty(QTextFormat.FullWidthSelection, QVariant(True))
ex.format.setBackground(QColor("red"))
ex.format.setForeground(QColor("green"))
edit.setExtraSelections([ex])
edit.show()
edit.setFocus()
app.exec_()
if __name__ == "__main__":
sys.exit(main() or 0)_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt