How to change the background colour of the line where text cursor (caret) is, using QSyntaxHighlighter
and QTextEdit
Asked
Active
Viewed 1,666 times
1

yolo
- 2,757
- 6
- 36
- 65
1 Answers
1
One way i found was using QTextEdit
QTextEdit *textEdit = centralWidget()->findChild<QTextEdit *>("textEdit");
QTextCursor textCursor(textEdit->document());
textCursor.select(QTextCursor::LineUnderCursor);
textEdit->setAutoFillBackground(true);
QPalette palette;
palette.setColor(QPalette::Background,QColor(200,200,200));
textEdit->setPalette(palette);
See if you find this usefull

megha
- 170
- 2
- 10
-
fills at the edges, not behind the current line – yolo Jun 14 '11 at 11:32