How to set background color for line (not text) in QTextEditor.
Example, every line start with text "DEPRECATED" will set background color red.
use QTextCharFormat only fill background for text![]()
How to set background color for line (not text) in QTextEditor.
Example, every line start with text "DEPRECATED" will set background color red.
use QTextCharFormat only fill background for text![]()
But, why the background color remove when I move cursor??
appendPlainText(QString("TAHEDE %1 ").arg(text));
moveCursor(QTextCursor::End);
moveCursor(QTextCursor::StartOfLine);
QTextEdit::ExtraSelection h;
h.cursor = textCursor();
h.format.setProperty(QTextFormat::FullWidthSelecti on, true);
h.format.setBackground(Qt::green);
QList<QTextEdit::ExtraSelection> extras;
extras << h;
setExtraSelections(extras);
Bookmarks